Javascript & Angular .js for the enterprise, lessons learned, typescript scalable code quality
Angular 1.x vs 2 - In code level
-
Upload
anuradha-bandara -
Category
Software
-
view
263 -
download
1
Transcript of Angular 1.x vs 2 - In code level
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