Tutorial hero
Lesson icon

What Impact Will AngularJS 2.0 Have on Ionic 1.x?

Originally published May 11, 2015 Time 7 mins

After a long, long time and about five seasons I have started watching the ever popular Game of Thrones. I can finally jump on the bandwagon and make my own poor attempt at rehashing a tired old meme:

Angular 2 is coming

AngularJS 2.0, which will likely be released within a year, will involve massive changes to the existing framework.

” [The] AngularJS team has been busy working on AngularJS 2.0. As we mentioned before, this is not a complex major update; this is a whole rewrite!” – ng-learn.org

Since Ionic is built on top of Angular, this also means big changes for Ionic. So I want to discuss a few issues this brings up and concerns existing Ionic developers, like me, might have.

Before I get started I’d like to put your mind at ease. If you are worried about using Ionic because of this or are worried that time you have spent learning Ionic will be wasted, fear not. Not only will Ionic support Angular 2.0 with Ionic 2.0 but they will also be continuing to support Ionic 1.x which will implement Angular 1.x.

In ng-conf, we have made a commitment to support v1 while significant people are still using it. So if you have an app in v1, you can stay using v1 and you will be supported, no need to upgrade. mhevery
Ionic 1.x will continue to be supported after Ionic2 comes out, same as Angular 1.x. Since Ionic2 is not completed yet we haven't finalized a migration path, but there will be one for those who choose to upgrade. Adam Bradley

I’m reasonably new to Ionic and Angular myself, and went into learning both knowing that this change was coming. I plan on upgrading to Ionic 2.0 and Angular 2.0 when they come out, but it’s good to know that we will be able to support our existing projects if we choose not to upgrade.

What is changing in Angular and why?

A lot. I’m not nearly intimate enough with Angular to make any criticisms or judgement on the new approach, but there’s certainly been quite a bit of backlash from the community. Many people are frustrated that the framework is changing so drastically and many people also question whether it is for the best.

For those short on time, some key changes so far in Angular 2 are:

  • Removal of Controllers
  • Removal of Directive Definition Object
  • Removal of $scope
  • Removal of angular.module
  • Removal of jqLite
  • Syntax changes
  • Existing Angular applications will not work on Angular 2.0
  • Uses ES6 (Ecmascript 6)

But for a more in depth discussion on the matter I would recommend reading this. The changes that are being made are being done to improve and future proof the framework. Personally, I’d prefer to be using a framework that is thinking too far forward rather than not moving forward at all, but I am not as heavily invested as some others and won’t need to relearn as much.

How will Angular 2.0 effect Ionic?

The Ionic team are at the forefront of Angular 2.0 development and have been in close contact with the Angular team in preparing for Angular 2.0.

The Ionic team is one of the earliest adopters of Angular 2 for a large project. Because of that, we are learning a lot about the intricacies, limitations, and power of Angular 2. We know that in order to get the community to embrace Angular 2, we need to start sharing our experiences and educating frontend developers on Angular 2. Max Lynch

If you plan on upgrading to Ionic 2.0 when it comes out then you will likely have a significant amount of relearning to do. When you’re building Ionic apps you’re mostly programming in Angular, so you will need to adapt to these massive changes in the framework.

To make the transition easier for those who are planning to upgrade, here’s some advice from the Ionic team:

In the meantime, we are going to be talking about ways to naturally move to [Angular / Ionic] 2. Today, we recommend a few things: use component-style directives (restrict: E), and use services. Try to limit your use of scope and controllers. The good thing is these are all best-practices in Angular 1 anyways, so you'll have a more natural update path. yesimahuman

Not everything is changing and a lot will still be the same though, a lot of the directives will remain the same and they have even hinted at an automatic upgrade tool:

Also, many of the directives are staying the same, so the markup you write won't be dramatically different. We are also thinking of an automated 1to2 tool as well. The benefit to 2 is really that it's a lot easier to learn and use than 1 was. It will make it easier to have your whole team help on the app, rather than just a hardcore angular person. yesimahuman

So what does this all mean for you right now?

Not a whole lot. Keep learning Angular 1 and Ionic and building cool mobile apps. If you want to jump on to Ionic 2.0 as soon as it’s released then maybe keep up with the Angular news and read a few articles about potential changes. But for the most part, it’s business as usual.

If you’re new to Ionic and Angular and want a bit of a kick start, make sure to check out Mobile Development for Web Developers.

 

Learn to build modern Angular apps with my course