Preference Order Of Including Angularjs In Index Page?
I'm newbie and learning to AngularJS and implementing a project. For many purpose, I have to include too many JavaScript in index.html page. I had read on another question that we
Solution 1:
The rule of thumb for source ordering is as follows:
- If you want to use jQuery, include it first. As per these docs.
- Include
angular.js
before everything else - Include all angular extension libraries
- All other third party libraries
- Your app code (if all your code is angular related, then the order of this shouldn't matter, unless you use
angular.module()
in a multifile way)
Also, look at this question with regards to where exactly to place your scripts: AngularJS in HEAD vs BODY
Solution 2:
Always remember to refer scripts in the order of their dependency, for example "angular-route" and "angular-animate" are dependent on "angular" so angular must be on top , like-wise "angular" uses "jqLite" for providing basic jQuery functionality , but if u want to use full functionality you need to refer jQuery on top of "angular", now you can decide which one to refer in which order. I hope this helps.
Post a Comment for "Preference Order Of Including Angularjs In Index Page?"