1

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 confuse about which one is right.

see KendoUI used jquery before AngularJs and their own library after it.

<script src="jquery.min.js"></script>
<script src="angular.min.js"></script>
<script src="kendo.all.min.js"></script>

What is the concept behind use jquery before AngularJs and Kendo or other library after AngularJs.

And why kendoUI will not work if we use it before AngularJs, what is the concept behind it.

1
  • Its taken from KendoUI official site . see demos.telerik.com/kendo-ui/grid/angular . I just want that it is right way and its also work with other library also ? Commented Jan 21, 2015 at 5:56

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

The OP is talking about kendo ui js if that is included before angularjs then don't work why...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.