Angular 1.x vs Angular 2.0 By Anuradha Bandara By Anuradha Bandar
Angular 1.x vs Angular 2.0By Anuradha Bandara
By Anuradha Bandara
Why ?Google’s Angular lead says they’ll also continue supporting Angular 1 for at least another year.”What we’ve said on that is we’re going to support Angular 1 until the majority of folks come over to Angular 2” says Green.
Why ?More perks on Angular 2
Better performance
Mobile first
Short learning curve
ECMA 6 - The future
No controllers & $scope
No ng-app
Angular 1.x have 2 ways for app bootstrap
● Using ng-app● Using javascript
No 5 ways of create a service
● Provider● Factory● Service● Constant● Value
DI No same like as previous
DI achieve via constructor
No $routerProvider & no when()
Route config use @routeconfig
Ng-view replace by <router-outlet>
No ng- for inbuilt directives
Use camelCase
● Ng-model : ngModel
● Ng-bind : ngBind
● Ng-class : ngClass
Direct access for html attributes
Use html attributes directly
● ng-href : href
● ng-src : src
● Ng-show / hide : hidden
More changes
Use html attributes directly
● ng-click : (click)
● ng-model : [(ngModel)]
● ng-href : [routerLink]
Thank you