“What”? “Why”? and “Advantages of Angular2”?
Why should you use Angular2 ? What are the Advantages of Angular2 ?
1. Angular2 has better performance.
2. Angular2 has more powerful template system.
3. Angular2 provide simpler APIs, lazy loading and easier to application debugging.
4. Angular2 much more testable
5. Angular2 provides to nested level components.
6. Angular2 execute run more than two programs at the same time.
7. Angular1 is controllers and $scope based but Angular2 is component based.
8. The Angular2 structural directives syntax is changed like ng-repeat is replaced with *ngFor etc.
9. In Angular2, local variables are defined using prefix (#) hash. You can see the below *ngFor loop Example.
There are more advantages over performance, template system, application debugging, testing, components and nested level components.
For Examples as,
Angular 1 Controller:-
Angular 2 Components using TypeScript:-
Here the @Component annotation is used to add the metadata to the class.
Bootstrapping in Angular 1 using ng-app,
Bootstrapping in Angular 2,
The Angular2 structural directives syntax is changed like ng-repeat is replaced with *ngFor etc.
For example as,
I hope you are enjoying with this post! Please share with you friends!! Thank you!!!