There is a major difference between Angular 1 and Angular 2. It’s not a version upgrade from 1 to 2 but it’s a complete rewrite. So with this article, we are trying to list down few major differences between Angular Js 1 and Angular JS 2.
1) Setup and configurations: Angular JS is better and easy to setup in comparison to Angular JS 2. While installation you just need to add the references of library and that’s it. If we will see version 2 of angular js, it’s depended on various libraries. So we can conclude that setup is easy in angular JS1 as compared to Angular JS 2.
2) Mobile oriented: When Angular JS 1 was introduced then mobile support was not the thought behind it. But if we will see Angular JS 2, it is fully mobile oriented. So it’s going to be a key point if you are planning for a native app. It can be used easily in tags. If you will add “Switch” then it will appear in the switch and if you will use “checkbox” then it will work accordingly.
3) Performance: In Angular js 2 it’s using Hierarchical Dependency Injection system i.e. the tree of injectors and it is going to become a huge performance boosted for angular 2 in comparison of angular 1. One more thing is performing a key role in performance is “unidirectional change detection tree”. So Angular 2 is giving better performance in comparison to angular 1. In Ng team meet up it was mentioned that Angular 2 is 5 times faster than Angular 1.
5) Controllers and scope: In Angular 2 controller is replaced with “component”. And also you will not find “Scope” in Angular 2. So basically structure is totally different. Angular is totally incorporated with “Component” and it’s using “Zone.js” to detect changes.
6) Variable: In Angular JS 1 local variable can be defined with “scope” whereas in Angular 2 it will be defined with the hash (#) as a prefix.
7) One-way data binding: In Angular 1 “ng-bind” is used for one-way data binding and in Angular 2 [property].
8) Two-way data binding: In Angular 1 “ng-model” and in Angular 2 “[(ngModel)]”.
9) Bootstrapping of Angular: In Angular 1 there are 2 ways for bootstrapping angular is “ng-app” and through “code”. Now in Angular 2, there is only one way i.e. “code”. Angular 2 is not using “ng-app”.
So there are lots of minor and major difference between Angular 1 and Angular 2. I have covered few major points here which I think will be helpful to understand the difference between the two.
Thanks for reading and keeping checking back for more stuff on Web development, Mobile development, Web design and Internet marketing.