Skip to content

Instantly share code, notes, and snippets.

@totten
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totten/6e6a84df8ef32be7e76b to your computer and use it in GitHub Desktop.
Save totten/6e6a84df8ef32be7e76b to your computer and use it in GitHub Desktop.
Order of <script> tags
<!--
The Civi-Angular modules require certain data be available. This example is good because the data is loaded
before the modules.
-->
<script type="text/javascript">
var CRM={"config":...};
</script>
...
<script type="text/javascript" src="http://d46.demo.civicrm.org/sites/all/modules/civicrm/bower_components/angular/angular.min.js?nnu1sv"></script>
<script type="text/javascript" src="/civicrm/ajax/angular-modules?format=js&amp;r=xyhQt"></script>
<!--
The Civi-Angular modules require certain data be available. This example is bad because the data is loaded
after the modules.
-->
<script type="text/javascript" src="http://d46.demo.civicrm.org/sites/all/modules/civicrm/bower_components/angular/angular.min.js?nnu1sv"></script>
<script type="text/javascript" src="/civicrm/ajax/angular-modules?format=js&amp;r=xyhQt"></script>
<script type="text/javascript">
var CRM={"config":...};
</script>
Notes:
v4.6.0 and v4.6.2 would present a bit differently. In v4.6.0, there are half a dozen
files loaded from civicrm/js/angular-*.js. In v4.6.2, those are consolidated into a single
request for civicrm/ajax/angular-modules?format=js. However, these have the same
ordering requirements -- they must appear *after* the "var CRM=..." snippet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment