A couple (or four) weeks ago Angular 2 went into developer preview with a beautiful brand new documentation and distributions that you can start playing with today. I hadn’t even looked at it to be honest, busy with other stuff, but I had kept my ear out for news and when pluralsight announced a webinar on the topic I thought it was the perfect time to find out more.
This is what I learned:
Angular 2 is in a very early stage of the developer preview, very unstable and it is constantly changing not only in the form and shape of the API but also in its core concepts and naming.
With Angular 2 you get everything you know and love from Angular 1 with a highly improved performance, a simpler mental model with fewer moving pieces and better access to the DOM.
The whole development story changes from using a standard MVC approach to a more componetized development where you have independent components and each has its template and underlying view model (like in aurelia). The components themselves are just ES6 classes that expose APIs to be bound to templates (no more
Angular 2 uses ES7 decorators to provide metadata to your components. They work sort of like attributes in C#. If you use ES5 to write your angular apps there’s alternative APIs to define this metadata. This is an example of a component from Joe Eames’ code sample on GitHub that can give you an idea about how the new component model looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
There is some interesting new notation for writing bindings within the html templates (
*for instead of
*if instead of
ng-if, binding with
1 2 3 4 5 6 7 8
The IoC story looks like is more explicit and less convention-over-configuration based although I have no clue how it will look in the final version:
1 2 3 4 5 6 7 8 9 10
You can start testing the developer preview by downloading the source code at code.angularjs.org (look for the 2.0.x and alphas). In terms of good editor support, there is sublime text that has great plugins for ES6 and ES7, Web Storm, and even Visual Studio Code or Visual Studio if you want to try Angular 2 with TypeScript.
And here you have the announcement of Angular 2 at ng-conf 2015:
I don’t know why people were so jumpy about breaking changes, this is looking gooood! Hope you enyojed the article! Have a nice day! :)
For more information about Angular 2 take a look at: