Check out myAngular article series with live demos and Facebook group Angular - Advanced Topics

Thoughts on Angular 2.0

Torgeir "Tor" Helgevold
- JavaScript Developer and Blogger
Published: Fri Dec 05 2014

A while back the Angular team made an announcement about their plans for the next generation of Angular – Angular 2.0. The presentation revealed changes that represent a big departure from the current 1.x version. Developers everywhere responded with a mixture of shock and disbelief after learning that core concepts of Angular 1.x would be dropped in 2.0. In fact it almost seemed as if the team had decided to create a brand new framework, but still name it Angular for brand recognition. However, in this post I want to explain why I think the new Angular approach is the right one.

I too was really surprised to see the new direction of Angular 2.0, but after thinking about it, I firmly believe it's the right move. It's commendable that the Angular team is trying to push the envelope and move Angular into the future in order to stay relevant. The changes may scare some, but it's in my opinion, a strength of our industry that our frameworks and technology are constantly evolving.

The radical approach of Angular 2.0 might be frustrating to developers who have already made a big investment in Angular 1.x core concepts, but I think the fear is exaggerated. The transition pains can probably be greatly reduced if you get into a general mindset of writing framework agnostic JavaScript code. The best way to ensure this in Angular is to move the bulk of your code to services. You only need to depend on Angular centric concepts like ng-controllers and directives when integrating your core code with your Angular application. Granted, Angular services still require some Angular syntax, but it's at the end of the day just a thin wrapper around your plain JavaScript code. Following this approach will not only prepare you for a move to Angular 2.0, but it will similarly prepare you for a migration to any JavaScript framework, should you choose to go a different direction in the future.

I am not saying the transition will be free, but if you think about it, taking a properly decoupled model and applying it to a different binding syntax is really not that complicated in the scheme of things. Sure you have to go over your views and make several updates, but a few well crafted “search and replaces” will probably get you started :-). Keep in mind, I am making the assumption that your code is already properly decoupled and in services, and only using controllers/directives as thin “pass through” layers.

In fact when you think about it, Angular with it's plain old JavaScript object bindings is probably better suited than most frameworks when it comes to being resilient to breaking changes.

I have created a few sample Angular 2.0 components here if you are interested in checking it out.

If you liked this article, share it with your friends on social media:

We also have a new Facebook group about advanced Angular topics.

I invite you to follow me on twitter