Angular 2 in Developer Preview

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:

  1. ES6 (The newest version of JavaScript) support, out of the box.
  2. Tight integration with TypeScript to simplify writing compilable code.
  3. Differentiation in the markup:
    1. Square brackets [] signify expressions or properties.
    2. Parenthesis () signify event listeners.
    3. The pound/number/hash symbol is used as a reference- particularly handy for iteration.
    4. Asterisk can be used for flow-control directives like “for.”  Combined with the # sign, it would look like: *for=”#name in names”
  4. Scope isolation!
  5. Transclusion is being retired.
  6. Shadow DOM and performance improvements.
  7. 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:

  1. No upgrade path.  If you want to convert your Angular 1.x application to version 2, it will take a good amount of work.
  2. 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.
  3. 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?

Submit a Comment

Your email address will not be published. Required fields are marked *