Skip to content Skip to sidebar Skip to footer

Which Is The Right Way To Add Jquery And Angularjs In One Project

I am starting to add Jquery and AngularJs in our next project. I seen some article say use Jquery before AngularJs and Some article used Jquery after AngularJs. so, I am little co

Solution 1:

Angular can work with or without jQuery. If loaded without jQuery already loaded, it'll use jQLite which only has a handful of jQuery functions. Reference

So if you plan to use jQuery in your JS it makes sense to load it before Angular which will prevent jQLite from being loaded at all.

Kendo UI includes Angular directives, which won't work correctly unless the Angular framework is loaded before it.

The same principle would apply to any library that uses the Angular framework. If a library does not use it then the load order has no effect.

Solution 2:

If you load jQuery after AngularJS, AngularJS attaches itself to jqLite but you can still access jQuery through $. This is not a good situation to be in. If you are going to use jQuery then you should always load it before AngularJS.

Post a Comment for "Which Is The Right Way To Add Jquery And Angularjs In One Project"