Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this good practice to use jQuery in Angular JS project? [closed]

I am new to Angular JS. I need to develop project using Angular JS, HTML5.

For DOM manipulation in previous project i have used jQuery framework. Now I am confused that is this good approach to use jQuery in Angular JS project. Because many of the functions of jQuery are already available with angular js i.e. jQLite but with some limitations.

I have asked many people also but no one's answer satisfied me, some say no and some say yes.

Please help me on this topic. I have search this question on stackoverflow also but no luck. I think it will be useful for other developers also who are new to Angular JS and want to develop application using Angular JS.

like image 475
Vijay Shegokar Avatar asked Apr 08 '15 03:04

Vijay Shegokar


Video Answer


1 Answers

The first thing you should do is to read this thread on SO "Thinking in AngularJS" if I have a jQuery background?. This will give you some perspective.

When it comes to Angular, it the model that drives the view and most of the times direct DOM manipulation is not required.

For example if you are using DOM manipulation to show\hide element, add remove class or set style, then better to use ng-show\ng-class\ng-style directive.

But there are cases when DOM manipulation is required and that is the time you write directives and either use jqLite or jQuery to manipulate DOM.

My suggestion would be to avoid jQuery unless you have to incorporate a jquery plugin that is dependent on jQuery.

While developing always look if the inbuilt directives that can serve your purpose. If not can jqLite be used to achieve what is desired. Your final resort should be jQuery.

like image 118
Chandermani Avatar answered Oct 09 '22 15:10

Chandermani