3

I saw a few blog articles saying that AngularJS and jQuery could be used together in one app. That seems good as jQuery has some functionalities Angular doesn't have and Angular allows us to make a greatly structured logic for a web app.

The fact is, as I'm french I also take a look at french blog articles about that, and french tends to say that we should never use jQuery and Angular together. I asked why on a forum and people said that it's probably because beginners usually use jQuery and Angular for the same things : adding elements dynamically, use ajax requests, etc... But I'd like to use jQuery for some things Angular does not do and to allow bootstrap js to work on my app.

What do you think, are jQuery and Angular bad at working together in one single app? Or does it just depend on how we make them work together?

7
  • 4
    It's fine to use jQuery with Angular, so long as jQuery is used exclusively to manipulate the DOM, just as you use jqLite. Otherwise you risk undermining the structure that Angular imposes. Commented Aug 19, 2015 at 14:43
  • 1
    I'm using both angular and jquery in some Projects and I never had a Problem with it. The only reason to avoid this, would be the fact, that angular implements the basic functionality of jquery, so it's a waist of some kbs of the bandwidth ;) Commented Aug 19, 2015 at 14:45
  • 1
    Angular and jQuery can be used together. In fact, Angular has its own jQuery implementation called jqLite, which has a subset of the features of jQuery. Conceptually, Angular is a layer on top of jQuery. You use jQuery in angular directives. Commented Aug 19, 2015 at 14:45
  • Ok thank you! I'd like to use jQuery for bootstrap.js and to detect the scroll position at some specific moment, angular still is managing the app Commented Aug 19, 2015 at 14:45
  • @sdgluck: depends on what kind of manipulation. Most of what jquery is normally used for, can be done with ng-show, ng-class and the like. Commented Aug 19, 2015 at 14:46

2 Answers 2

2

AngularJS uses JQuery itself, the major reason not to mix and match is just what you described of them stepping on each other's toes.

While I was learning Angular a lot of the time I would end up using JQuery alongside it because I didn't understand Angular or know it's full capabilities. After learning it better my code has continuously less JQuery in it, but if I can't figure it out in angular, I'll make sure it works with JQuery until I can get it.

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

1 Comment

The main reason I avoid jquery is to not implement code in a non-angular way. Like looking for child elements rather than having directives.
0

I guess it depends on what you're aiming for. If you want to develop an Angular app, then Angular already includes a version of jQuery called jQlite, but you can still use jQuery in your Angular app if you want to.

You can actually "wrap" jQuery code into custom Angular directives, which is pretty sweet.

In an Angular app it's safe to include jQuery if you want to implement some Bootstrap functionality. Currently, I'm doing that to implement Bootstrap's collapse component. I have only just begun developing in Angular, so I am not an expert as to all the ins-and-outs of using jQuery with Angular.

Comments

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.