Every AngularJs developer little bit confused and ask to angular and other community why angularjs 2.0? why not angular 1.x+?
Go to below link for ES6 and Traceur.
This example demo using for-each in angular version v1.x vs. v2.0.
AngularJs 1.x : foreach
- First app with Angular 2 and ES6
- Integration of Angular 1 and Angular 2
- What are major changes in Angular 2?
- New Features of Angular 2
- What is ECMAScript ES6?
- What is Traceur compiler?
- In Angular v2.0, we are using classes more than in Angular v1.x+ and the ES6 has a better classes syntax than ES5.
- The Goal of Angular v2.0 it should be declarative.
- The Syntax of Angular v2.0 are human-readable and human-writable.
- The Angular v2.0 deals with server data in form of a JSON and its is structural types on the JSON as well as on the Angular API.
- The Angular v2.0 will be written in ES6 and it compiled into ES5 using "traceur". The Angular users can write your code using ES6 or ES5 both are working fine in v2.0.
- The Angular v2.0 have the ability to attach the "meta-data" to Angular framework "Types" or your code.
- I can say, AngularJs 2.0 is Predictable.
- I can say, AngularJs 2.0 is Tool able etc.
Go to below link for ES6 and Traceur.
For example how can say, the Angular v2.0 is simpler then Angular 1.x+. The example as given below.
This example demo using for-each in angular version v1.x vs. v2.0.
AngularJs 1.x : foreach
1
2
3
4
| //Angularjs 1.x example <li ng-repeat= "user in users" > <h2>{{user.name}}</h2> </li> |
//Angularjs 1.x example
<li ng-repeat="user in users">
<h2>{{user.name}}</h2>
</li>
AngularJs 2.0 : foreach
1
2
3
4
5
6
| //Angularjs 2.0 example <ul> <li *foreach= "#user in users" > {{user.name}} </li> </ul> |
//Angularjs 2.0 example
<ul>
<li *foreach="#user in users">
{{user.name}}
</li>
</ul>
For more details you can go on below link.
http://www.code-sample.com/2015/03/whats-new-in-angularjs-20.html
What do you think about AngularJs 2.0? I hope you will enjoy and put a valuable comment for the same.
Thank you!