1

i want to implement Angular JS, Angular JS UI plugins and bootstrap in my ASP MVC 5 apps. Some people say Jquery is still in use in Angular JS part, so could any one here please explain when and where i would need to use JQuery in Angular Js code?

jon dynke
  • 33
  • 6

1 Answers1

1

Angular doesn't include jQuery but a light-weight plugin called jq-lite. This provides a lot of the methods that jQuery does, but not all of them.

It specifically has to do with Angular.element. You can take a look at the documentation here

https://docs.angularjs.org/api/ng/function/angular.element

jqLite is a tiny, API-compatible subset of jQuery that allows Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most commonly needed functionality with the goal of having a very small footprint.

Basically, there are a couple of pointers to keep in mind

  1. Keep all DOM logic outside of the controllers. Use custom directives on attributes for that.
  2. Instead of simulating mouse events, use their angular counterparts. Examples include ng-click and ng-mouseover. Add these directives to the elements in the form of attributes.
  3. Instead of adding classes, use ng-class
  4. If you are using jquery or jqlite, be sure to include the jquery script before the angular script.
Richard Hamilton
  • 25,478
  • 10
  • 60
  • 87
  • is it recommended to use Angular JS with Jquery 'cus if all things that were done using JQuery now can be done with Angular JS then is there a good professional reason to dwell in Jquery – jon dynke Feb 18 '16 at 22:34
  • 1
    I'd opt against it. See this post http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background – Richard Hamilton Feb 18 '16 at 22:46