It was announced today that Angular version 2 has moved out of “Alpha” release phase and into Developer Preview. For geeks like me, this is big news.
Here at work, Angular.js has become a favorite tool. I totally geek out about model binding, Bootstrap UI, and declarative HTML. But I’ve been hesitant to start any new projects in Angular.js v 1.x because version 2 is so close.
Angular 2 is going to solve a lot of problems for Angular developers: it will be easier to write directives/components, there will be a “right” way to write services, and even the markup attributes help clean things up. The reason all this matters is that developers can write cleaner, more bug-free code, faster and with less hassle. Considering the gift that was Angular 1.x, that’s saying something.
My favorite things I’ve seen so far, in no particular order:
- Tight integration with TypeScript to simplify writing compilable code.
- Differentiation in the markup:
- Square brackets  signify expressions or properties.
- Parenthesis () signify event listeners.
- The pound/number/hash symbol is used as a reference- particularly handy for iteration.
- Asterisk can be used for flow-control directives like “for.” Combined with the # sign, it would look like: *for=”#name in names”
- Scope isolation!
- Transclusion is being retired.
- Shadow DOM and performance improvements.
- Data-binding can be once, one-way, or two way; this can contribute to performance and clarity of code.
Of course it’s not all clear sailing. There are still a lot of questions, clarifications, and complaints. The Angular team is taking a big leap with this new framework, and I see some pain points ahead:
- No upgrade path. If you want to convert your Angular 1.x application to version 2, it will take a good amount of work.
- New syntax=learning curve. Developers who invested heavily in Angular 1 are understandably irritated that a lot of that investment is lost on what feels like a brand new set of rules.
- Some of that new syntax doesn’t really run on some browsers. For instance the bracket syntax  is technically valid HTML, but some browsers throw a hissy fit if you try to use it.
In short, watching Angular 2.0 shape up is fascinating, scary, but in general very exciting. If you’re an Angular user, what are your thoughts?