Explain the advantages of Angular over jQuery, if any. In what cases it is more expedient to use an angular?

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants of Grundy , aleksandr barakin , Denis , Kromster , Alex December 2 , '13 at 1:30 pm .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Judging by the question (apparently there is no understanding of the framework (~ s), there should be a simple answer: Angular type frameworks are necessary when we are developing a relatively complex application, not a site. Ie when it is necessary to operate with data structures, their method of storing, loading, processing and visualization. Moreover, the separation of all these processes into separate components helps to quickly replace their implementation with a new one, without affecting the main part. - Aleksander K.

2 answers 2

I will not go deep. The answer is very simple.

jQuery is a library that allows you to do complex things on js in simple ways (in particular, at the expense of widgets and plug-ins).

AngularJS is an MVC framework that takes over the complete generation of a page using templates and models, and controls it using two-way data-binding, changing it using the logic of your application.

They are fundamentally different in purpose. Even the fact that AngularJS already contains jQuery (its lightweight version of jQLite ) already says that these are completely different things that perform different tasks.

If it is very simple:

  • jQuery is a library to instead

document.querySelector('[data-bind="example"]') .addEventListener('click', function () { ... }, false);

write

$('[data-bind="example"]') .on('click', function () { ... });

and to support all browsers.

  • AngularJS is to make a single page application (where after clicking on each link the page will not reload completely, but the transition will take place immediately) and write the whole Frontend on it.
  • After answering, there is a feeling that Angular is only for SPA. It is not . - Vadim Ovchinnikov
  • Regarding the comparison of browser support for the latest jQuery (IE9 +), except that older versions (1.12-) have IE6-8 support, while Angular also has IE9 + support ( angular.io/docs/ts/latest/guide/browser-support .html ), version 1.2- has support for IE8. Therefore, the argument "and that all browsers support this" disagrees. - Vadim Ovchinnikov
  1. Bindings, especially bilateral, in Angular greatly simplify life compared to jQuery.
  2. Declarativeness and writing readable templates (DQ modifications in jQuery are much less maintainable and obvious at first glance).
  3. Angular is written with regard to modularity and testability, and therefore contains Dependency injection.
  • implementation of the binding is not very good and with a large number of bilateral - it makes life more difficult than simple. For jQuery there is a bunch of template engines. Nobody forbids writing code with jQuery with regard to modularity and testability. As you can see, all three points depend on the views of a particular developer. And questions in which it is impossible to give an objectively correct answer should be either edited or closed. - Grundy
  • I agree, but what I have described is out of the box and do not need to use something extra. The library itself predisposes to this. - Vadim Ovchinnikov
  • This is all because the library is only jQuery. Therefore, to compare the set of functions and the framework of the application is somewhat incorrect. Especially considering that the angular uses the trimmed version of jQuery inside it, and it can use the regular one. - Grundy
  • I don’t mind if the question is closed or my answer is completed, etc. But I still find this question very useful, especially for beginners or those who have been sitting on jQuery for the rest of their lives. No wonder in English SO the same question is so popular. - Vadim Ovchinnikov
  • and also closed closed as too broad . In addition, there is a slightly different question, and not just Angular vs jQuery - Grundy