Back to blog home page

A Hint of What’s to Come: AngularJS 2.0

Posted by on Mar 23, 2015

Over the past several months, a lot has been written about the forthcoming changes in AngularJS 2.0. While not much is available in the way of details, there are some changes that have been released by the Angular 2.0 team that have raised a lot of concerns among seasoned AngularJS developers. In this article we’ll take a brief look at what is changing, how it impacts your application, and anything to keep in mind when making the transition from Angular 1.X.

DOM Handling

One of the major performance concerns with AngularJS 1.X was that it used a number of behind-the-scenes techniques to ensure that presentation of the DOM was consistent across multiple browsers. This was achieved via the DOM Wrapper, which worked to ensure that consistent visuals were produced for each browser architecture. Naturally, a wrapper of this type added some additional weight to the framework, resulting in some performance hits. In the several years since the inception of Angular 1.X, though, most browsers have standardized on DOM handling that more closely matches standards, meaning that in the strictest sense the DOM wrapper is no longer necessary. While this has the potential to introduce incompatibilities in older versions of popular browsers (such as IE 8 and 9), the reduced code base should improve the framework’s stability and performance.

Code Structure and Development

Many of the ways that Angular used to inject functionality into the standard HTML DOM have changed in AngularJS 2.0. AngularJS 2.0 will make use of AtScript, a superset of JavaScript built off of Microsoft’s TypeScript. This adds annotations and introspection to AngularJS, which allow the developer to both more clearly express their intent in their application’s code and handle types in a more explicit fashion at run time. The AtScript component can add a lot of peace of mind to the development process, but as it can remove some type flexibility it has been designed to be optional in AngularJS 2.0 – meaning if you don’t want it, you don’t need to use it.

Performance

As evidenced above with both the removal of the DOM wrapper and the enhancements to the development process gained by adding AtScript, one of the benefits of AngularJS 2.0 is that it will, in many areas, be more performant than 1.X. Mobile development in particular is set to see major performance gains through the use of AtScript and through the many major framework revisions added by the Angular team. Template compilation and the new usage of the DOM will add additional performance enhancements, and while no single element represents a major performance improvement, the changes to the framework end up coalescing into what may end up being a significantly more reactive JavaScript framework.

Conclusion

The above changes are only a subset of the items being modified in Angular 2.0. One thing not mentioned, for example, was the extensive work done on the Templating and Data-binding functionality which can have a significant impact in terms of development experience and developer throughput. However, at this point – with the Angular team likely targeting an end-of-2015 window for release – it is hard to nail down a “final” feature set. With active development continuing on the framework, the only constant at this point is change. That being said, the elements mentioned above are largely being touted as core components of the new framework model, and are relatively unlikely to change in a significant way prior to release. While exact numbers are obviously not available, it is a safe bet to say that the AngularJS team has the developer experience in mind, with a focus on improving stability and performance to the extent possible while extending the framework to accommodate the newer functionality and more consistent DOM representations of modern browsers. While there will be some transitory pain when moving to the new version, so far everything is looking to be worth the effort.