47

I was reading that AngularJS comes with a lite version of jQuery. However I keep hearing reference to people who talk about Angular and jQuery going together. I even checked out ng-grid and noticed that it says:

Angular Data Grid written in AngularJS and jQuery by the AngularUI Team

So if I do use Angular just when would I need jQuery and what does the version that comes as part of AngularJS not provide?

TimS
  • 5,922
  • 6
  • 35
  • 55
Alan2
  • 23,493
  • 79
  • 256
  • 450
  • 1
    [docs- explanation of what jQlite does provide](http://docs.angularjs.org/api/angular.element) easily found in search of `jQlite` – charlietfl Mar 30 '13 at 18:47

1 Answers1

74

jQLite is a very stripped-down version of jQuery. jQLite is enough for angular to work. This is to minimize dependencies.

Yet, if you load jQuery before angular, then angular will use jQuery.

Most of the time, you do not need to use jQuery. Even so much that, for beginners, it is advised to leave out jQuery completely as there would be a tendency to use jQuery when there is an easy / angular way. There has been so many examples on this (mostly showing and hiding elements through jQuery when there are ngShow and ngHide directives).

Later on, when you start to write directives, you then may need to add jQuery.

ngGrid possibly does many things for which jqLite would not suffice. Thus, they used jQuery.

Documentation and features of jqLite: http://docs.angularjs.org/api/angular.element

Christopher Berman
  • 719
  • 1
  • 5
  • 21
Umur Kontacı
  • 35,403
  • 8
  • 73
  • 96
  • 5
    Well said! The most common jQuery usages I see are for animation when CSS transitions simply aren't enough and for using complex existing plugins where the rewrite payoff may not be immediately there. – Josh David Miller Mar 31 '13 at 03:24