Upgrading to Angular 2.0 Experience: What Do You Need to Know

February 01, 2017 | Software Engineering | Artem Kulish

AngularJS is currently reliving its renaissance, both metaphorically and literally. The latest version of Angular 2, one of the most popular JavaScript frameworks, was published just a few months ago, bringing a huge number of changes. Read on our article to learn about some big and small changes, introduced with the new version of Angular 2.0.

Angular 2: A Not So Direct Update

Announced back in 2014, Angular 2 was not a straight upgrade, but rather a completely new product. As the whole framework would be largely rewritten, Angular 2 brought no backward compatibility, no options for upgrade or migration. Thus, all modules, all plugins, and components had to be rewritten as well. In other words, if you want to migrate an app from older AngularJS to Angular 2, you’ll need to rewrite the code from scratch. The announcement received a mixed reaction of the developers’ community and raised a wave of discussions in regards to the future of the framework.

Naturally, businesses were affected as well. Right now, companies still have time to switch to Angular 2.0. However, older versions of AngularJS will soon come to an end of their lifecycle and will no longer be supported. As businesses need to keep their products and infrastructure up-to-date, they definitely need to get familiar with Angular 2 and in the nearest future rebuild their apps to keep a competitive advantage.

What is Angular 2.0

A Google product, Angular was initially released in October 2010 with the next update coming in September 2016. Indeed, developers need to get used to the changes, introduced with the new framework. At the same time, something new doesn’t always mean worse. This rule is perfectly known to businesses. More and more companies express their interest in migrating their apps to Angular 2.0 and getting new solutions built with an updated version of the framework.

One doesn’t need a dedicated methodology to study Angular. While all basic principles remain similar to the previous versions of the framework, the new version is largely different in terms of project development methods.

Just as the older versions, Angular 2 utilizes a component method for app development. All elements of an application are stand-alone components, following a strict integration structure. Here is a small flaw of Angular 2.0: as the framework is relatively new, most Angular 2 components are still in alfa. As the development goes on, the situation will change and more components will be updated and finalized. Until then, consider the following: when solving Angular 2 issues, most likely you’re dealing with a component flaw to be fixed with the future builds. Contact us for help.

Angular 2: Critical Changes

While the list of specific changes is huge, the major changes are:

TypeScript support.The previous versions of Angular were based on ECMAScript 5, which didn’t support TypeScript natively. Angular 2 features ECMAScript 6 and brings the native support of TypeScript, an open-source and a very effective superset of JavaScript. A strongly-typed script, TypeScript offers a more coherent and accurate code structure in comparison to JavaScript. This saves development time, as when building apps with TypeScript, developers have fewer chances to produce incorrect or incoherent bits of the code. At the same time, TypeScript improves and eases understanding of the client app, as it resembles a regular server code.

Differences in Operations Processing. While the previous versions addressed the DOM page directly, Angular 2 loads XML page to the virtual memory. As the page is assembled in a virtual DOM, it results in noticeable performance improvements, totaling to up to 3 times of productivity boost according to the tests.

Scalability. In 2 years from now, it will be hard or next to impossible to support Angular 1-1.5 based apps. Google Angular Team plans to publish updates to Angular at least twice a year, with fewer changes and this time with backward compatibility. As of January 2017, the Angular 4.0 is already being beta-tested and is set to be released in March 2017.

Cross-platform development through NativeScript support. Angular 2 allows reusing the code for mobile apps. It was possible to build cross-platform apps before by integrating a number of extra frameworks (e.g., Ionic or Cordova shell). Besides NativeScript, Angular 2 doesn’t require extra wraps or frameworks to build mobile apps. It is possible to develop both web and mobile apps with the same components. This saves development time and the solution price to a great extent, as you don’t need to develop the same app from the ground up for each platform.

All these changes benefit development process on many levels, making a jump to Angular totally worth the hassle.

Don’t miss our next article on Angular first-hand experience. We’ll explore a couple of projects we’ve developed for one of our customers using a mix of Angular and MS SharePoint.