The actual role of jQuery in data-driven web applications

The actual role of jQuery in data-driven web applications

You can't simply use only jQuery in data-driven web applications. This doesn't imply that jQuery cannot be used in such cases.

You can't simply use only jQuery in data-driven web applications. This doesn't imply that jQuery cannot be used in such cases.

jQuery works on a different layer

jQuery can be used on the behavioral layer of an application model. While Angular operates on data through the interaction with a REST service, jQuery can operate on basic user interactions or through the manipulation of the DOM structure of the page.

Here's an example: you run a GET request using a REST service with Angular to retrieve a list of posts. Then you can use jQuery to create an advanced masonry grid to display the lateest posts. However, using jQuery to perform a GET request through a proxy is a design error in data-driven applications.

In other words, jQuery can play an active role in data-driven applications but always in a specific context.

jQuery should handle only visual actions

When it comes to actions, we should again keep data separated from behavior. jQuery should handle only actions related to visual effects, not to data. For example, if a button fades in or out an element, then jQuery can be used to handle it. But if this button handles data, then it's up to Angular to handle it.

To put it simple: you can use jQuery in data-driven web applications but only if you use it in a specific context.