Angular 1 vs Angular 2
- First thing, Angular 2 is not the upgrade of Angular 1 Angular 2 is completely rewritten.
- Angular is using Typescript which is super set of javascript (It doesn’t mean only typescript, dart also).
- Angular 1.x was not built with mobile support in mind, where Angular 2 is mobile oriented.
- Angular 1 core concept was $scope, and you will not find $scope in angular 2.0. Angular 2 is using zone.js to detect changes. See the below code.
- Angular 1.x controllers are gon. We can say that controllers are replaced with “Components” in Angular 2.
- In Angular 2, Structural directives syntax is changed.
ng-repeat
is replaced with*ngFor
.
- In Angular 2, local variables are defined using hash(#) prefix.
- Two-way data binding: ng-model replaced with [(ngModel)]
· Angular 2 is mobile oriented & better in performance.
· Angular 2 provides more choice for languages.
· Angular 2 implements web standards like components.
· AngularJS 2.0 is not easy to setup as AngularJS 1.x.
· Angular 1.x controllers and $scope are gone.
· Different ways to define local variables.
· Structural directives syntax is changed.
· Angular 2 uses camelCase syntax for built-in directives.
· Angular 2, directly uses the valid HTML DOM element properties and events.
· One-way data binding directive replaced with [property].
· Two-way data binding: ng-model replaced with [(ngModel)]
· Way of Bootstrapping Angular Application is changed:
· Ways of Dependency Injection is Changed- syntax changed.
· Way of routing is Changed- syntax changed.