Lately there has been some news around Angular 2.0. There are some odd things about working with Angular 1.3 that I’ve experienced during project work, which they have tried to address. However, it got ugly on various parts.
In this blogpost I discuss various changes, as I could interpret from blogposts and conference videos. Note that Angular 2.0 is not yet ready.
First and foremost, I really like the way they put performance on the agenda, especially for less powerful devices such as smartphones. It is good to discuss performance as an ongoing topic while building any kind of application, web-app or non-web-app.
A thing that went weird in Angular was the scoping, especially communicating between nested scopes of several directives. Communicating up the tree was really hard to do, and it seems the Angular team has fixed the issue by removing separate scopes. In general, it will be easier to talk between various components.
Directives for elements are now ComponentDirectives. The other types of directives have also various names, and that makes a lot of sense because the code will be less cluttered. This means controllers are gone as well, because most controllers would control the element directives.
Bundling up the various forms of directives, and combine them with services will be made easy by removing the dependency injection. Instead, Angular 2.0 will use EcmaScript 6 modules. In the same style, jqLite will be removed in favour of using bare DOM methods.
There is a new syntax for templates, with some interesting ideas. Interesting in the sense, that it might be hard for people, software and various tools to cope with it.
The two types bindings, event and property binding:
The release date is set to the far future, somewhere at the beginning of 2016 we will be able to really try and use Angular 2.0. However, the support for Angular 1.3 will be discontinued shortly after it will get released.
For the very distinctive changes Angular 2.0 has, as compared to Angular 1.3, one would expect some more time than just 18 months to rewrite all of the code base. Rewriting is a necessity, and no company will like standing still with developments on any software project.
Google invented a new metalanguage to make all this happen for Angular 2.0: Atscript, which compiles to EcmaScript 6. To build a web app with Angular 2.0 requires writing Atscript. The new language is some syntactic sugar that will make the web a bit more obese.
I really hope the Angular team listens to the various feedback it will receive. I really like the new way directives work and how dependancies are handled. I hope they are aware of the impact the changes will have, especially those mentioned in the ‘ugly’-sections.
Written by Arjan Eising