Patrick Reck
Patrick Reck

Reputation: 11374

Using AngularJS as alternative to JQuery

I am currently developing an application where I need some richer elements. Some of these are searches live updating, adding checkboxes to arrays and the like.

I have successfully implemented this using AngularJS, but I am not really sure if it's good practice to use AngularJS on just a few pages.

Would it be better practice to use JQuery for this purpose, and does it go against the goal of AngularJS?

Upvotes: 0

Views: 1260

Answers (2)

NicolasMoise
NicolasMoise

Reputation: 7279

Yea the transition from AngularJS can be a difficult one. Of course, they can both be used side-by-side but it kinda defeats the purpose of Angular. I use to be big jQuery user but I've tried to stay as far away from it as I can when using Angular.

Sometimes I'll come across a problem and I'll think to myself "Wow this would be so simple to do in jQuery". But if I stick to Angular and use their philosophy, I find that the "Angular" solution is often the one that uses better coding practices.

TL;DR: AngularJS and jQuery work fine side-by-side but I recommend getting into the habit of using just Angular, as it will result in more organized, maintainable and understandable code.

Upvotes: 2

Katie Kilian
Katie Kilian

Reputation: 6995

They can be used together. The two libraries have different purposes. jQuery provides an alternate interface to the DOM that is more consistent across all the browsers, so you don't have to worry about various browser eccentricities. AngularJS is a framework that provides for such things like binding MVC-style objects on the client side.

Upvotes: 1

Related Questions