Ever since Angular 2.0 was announced at ng-Europe in October 2014, there’s been quite a bit of fud around it with many people being frustrated and fretting about having to completely rewrite their apps. All this is to be expected… the Angular team did a poor job of announcing it with poorly done slides of tombstones & very little explanation for those of us who weren’t in the audience. Then they took forever to clarify but in March 2015 at ng-conf in Salt Lake City, Utah, they did a much better job.
In this post I’m going to give my take on trying to explain where I see things and how you should approach them, or at least how I’m going to approach it.
Where Are We Today?
First let’s take stock of where we are today. Angular 1.3.x is the current version RTM or production release that you should be using in new apps you’re building. Angular 1.4 will be released any day now as we’re seeing release candidates starting to ship.
Angular 2.0 is not finished and even if you wanted to build an app with 2.0, it would be very challenging as the build process involves many moving parts. From my understanding we’re months if not 6 months away from a real Angular 2.0 release that you can use in your apps.
Another question you may ask yourself is “how long will Google support Angular 1.x?” Good question, but I’ll tackle that a little later in this post…
Why Do We Need Angular 2.0?
You don’t… to be quite blunt. If you have an app that works today and you’re using 1.3 or even a 1.2 or 1.1 version of Angular, you don’t have to do anything… it will continue to work just fine.
But when the team surveyed their current state of Angular and asked the community what they wanted, they got feedback that forced them to say “we can’t get there with what we have today… we need a new version.” Now like any jump in major versions, there are things that scare folks as there is a lot of change, but it’s all for good reason.
I assume a lot of my readers are ASP.NET developers. Think about it this way. When we first started building ASP.NET websites we were using Web Forms right? They worked… but some who saw the MVC model realized that was really the way to go. Finally Microsoft came out with ASP.NET MVC, but it was a HUGE shift in our thinking. You couldn’t just update a WebForms app to be MVC… it was a complete rewrite. Existing sites didn’t need to be updated, they could be left as WebForms and in fact, we still see some new sites created with WebForms, although MVC is clearly the dominant way of doing things.
Think about this in the way of Angular. ASP.NET WebForms is Angular 1.x… it’s what we started with, it’s still the released and stable version, and even when something new comes out it’s what we’ll use for quite some time. Now look at Angular 2.0 as ASP.NET MVC… there are tons of reasons why MVC is better and why, when it is released, we want to strongly consider it for our apps provided it works for our users / customers. I’ll walk through some of those in a minute.
But take this analogy to heart… just because Angular 2.0 is coming or when it is available, don’t think you have to jump to it right away… because you clearly don’t… you’ve got plenty of time to wait.
What’s the Appeal of Angular 2.0?
So… why should you care about Angular 2.0? There are plenty of improvements around performance that will dramatically speed up your apps. There’s also a new router that’s optimized for mobile & complex navigation scenarios (check this session from ng-conf for details), tons of stuff for internationalization (i18n) and tons of changes to data binding.
You might have seen some of the syntax that looks a little funky for the data binding for Angular 2.0… I agree, it’s funky when you see it. But when you understand why it’s changing an what the changes mean to you, it makes perfect sense. For instance, did you know that while every HTML object has properties, the attributes (the things in the HTML tags) map to properties, but not all properties are represented by attributes? What this means is that there are a lot of Angular directives from 1.x that we can remove and thus simplify Angular 2.0. Confused or want to learn more? Check out the day 2 keynote from Misko where he talks about the directives we can get rid of… rewind about 5 minutes to see the explanation of why.
The Path to Angular 2.0… What about Angular 1.x when 2.0 Is Available?
How will we get to Angular 2.0? Today it isn’t ready and we don’t know when it will be. Google said that in May 2015 they will start migrating a very large internal application to Angular 2.0. This experience will tell them how close they are and how far they have to go… so we should learn at lot at that point. You might not care as the supported browsers for Angular 2.0 will be all evergreen browsers and IE11… yes, IE11.
But how will they get there? Once Angular 2.0 is released Google will continue to work on Angular 1.x for features & fixes. They won’t force anyone to move over… and they will continue to work on 1.x while there’s interest. How is that going to be measured? Angular 1.x & the docs will continue to be hosted at angularjs.org while Angular 2.0 will be hosted at a new site: angular.io. They will watch the traffic to both, the requests for the libraries from their CDN and publish these numbers at relevant conferences. Once there’s enough evidence to show that people have migrated, they’ll the focus all their efforts on Angular 2.0.
I wish all software companies would do this… this incentivizes the Angular team to give you enough reason to migrate form 1.x to 2.0. Seems fair, transparent and focused on the customer first.
When you do elect to migrate to Angular 2.0, you can do it with a few different options. you can do it big bang (full rewrite of your app) or you can do it incrementally. The latter option lets you have your 1.x application use 2.0 features within it (like a 2.0 controller) or have the application be hosted by 2.0’s router while you use 1.x controllers. This is a flexible process where you can migrate your app at your own pace or all at once.
Hopefully this helps clear some stuff up. I know you’re probably looking for code samples, but since so much stuff might change between now and 2.0’s release, it’s not important in my opinion. You won’t be building in 2.0 today, so why rush it now?