Difference between Angular JS & Angular 2

Angular

 Difference between Angular JS & Angular 2

  1. Angular 2 is not the upgrade of angularjs. It is completely rewritten.
  2. Angular 2 uses Typescript which is a superset of JavaScript (It doesn’t mean the only typescript, dart also).
  3. A1 was not built with mobile support in mind, where Angular 2 is mobile oriented.
  4. Angularjs core concept was used a $scope but we will not use the $scope in angular 2.0.
  5. In Angular 2, Structural directives syntax is changed ng-repeat is replaced with *ngfor.
  6. Angular 1.x controllers are gone. We can say that controllers are replaced with “Components” in Angular 2.
  7. In Angular 2, local variables are defined using hash(#) prefix.
  8. Angular 2 is using Hierarchical Dependency Injection system which is major performance booster.
  9. One way and Two-way data binding same as but ng-model replaced with [(ngModel)]
  10. Angular 2 implements unidirectional tree based change detection which again increases performance.
  11. AngularJs filter Top replaces with the Pipes in angular 2, we use the pipe character (I) and one or more filters.
  12. Angular 2 uses camelCase syntax for built-in directives. For example, ng-class is now ngClass and ng-model is now ngModel.
  13. One of the features of Angular is Dependency Injection. With Angular 2 DI is there but now there is a different way to inject dependencies. As everything is class in Angular, so DI is achieved via the constructor.
Please follow and like us:
500

Leave a Reply

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