Why Jquery is bad for angular application?

I have seen some developers still use jQuery in their angular application. I also used jQuery in angular in early days of development. There are numerous reasons behind using jQuery is bad for angular application which is listed below:
• Easy Dom manipulation
• Easy to use
• Saves much time in the development
• No need to use other plugins
• Large community

Why jQuery is bad for angular application?
So, we know that jQuery provides whole DOM manipulation while the angular is a single page application. The problem with the whole DOM manipulation in if you apply one CSS property to some element then It will affect the whole application because angular is the single page application (SPA).

Here is a small example that I have implemented in stackblitz.

In the above example, I have declared two paragraphs i.e. one in parent component and one in the child component. Now I am applying one CSS using jQuery i.e. $(‘p’).css(‘color’,’blue’);.

Now if you see that this jQuery CSS is applied to both p tag that we have declared in child and parent component. This is because earlier we have discussed that jQuery provides whole DOM manipulation. Now, this is easy to track because it is a small application but when an application gets bigger it will create lots of problems.

Solution: When you are trying to apply jQuery in your project try to look for possible alternatives for it. For example, if you are applying animation using jQuery then instead of it, you can use angular animation. There are always alternatives to jQuery. It may take to find out and apply but it will not break your application when you are scaling it.

So, it is advisable that you can don’t use jQuery in your angular application. Share this article with the angular developers and let them know this problem. Happy Coding.

Front-end Developer. Passionate about designing, digital marketing, writing, and tea. You can connect with me on social media by links given below.

Leave a Reply

Your email address will not be published. Required fields are marked *