Does Angular 2 replace jQuery and AJAX?

4

With the use of Angular 2, is it still necessary to use jQuery and AJAX or does Angular replace 100% of these 2 technologies?

    
asked by anonymous 01.09.2017 / 15:37

1 answer

8

Angular makes 100% replacement. It is possible to mix if you are dependent on old code. But the idea is to leave jQuery behind ...

If you never knew that jQuery existed it was almost better to start an app in Angular, Vue or React:)

The concept of this new generation of reactive applications is not to tinker with the DOM like it used to. The application takes care of the DOM and the programming paradigm must be more functional / reactive. When something in the state (state) of the application changes this should be reflected in the DOM. And not as formerly: using jQuery to implement in the DOM what is in the state. Or even worse, go read in the data DOM for processing the application.

There are obviously things in which jQuery can still be useful. Ajax is one of them. But it is preferable in this case to use more specialized libraries for functionalities that are necessary. Angular has $http , React and Vue.js are agnostic, meaning you can use whatever you want. If necessary, Axios is a good alternative.

    
01.09.2017 / 15:41