AngularJS is an open source web development framework that’s maintained by Google and the Angular community.
Angular has been generating controversy in the tech press recently. The release of Angular 2.0 promises much but some developers aren’t happy with the migration path between the 2 versions. Version 2.0’s first release candidate has just been published on 5th May.
Google released Angular 1.5 in February this year as an upgrade of version 1.0 that was also designed to help the transition to Angular 2.0. Angular incorporates “Components” which simplifies configuration. In Angular 2.0 directives and controllers have been replaced by a model that’s based on components.
The changes to AngularJS 2.0 are massive and amount to a rewrite of the angular Framework. The latest version of AngularJS aims to give a better performance than its predecessor. The AngularJS blog refers to it being speeded up with a linear (Blindingly fast) scalability. It allows other web components that have been developed using other libraries like X-Tag to be incorporated.
Also, according to Developerdrive.com, V2.0 aligns the framework with the world of mobile computing: it offers a “mobile first” approach which includes features like low memory consumption and bandwidth usage; touch support and many more.
There’s also a sharper focus on future proofing with the developers of Angular 2.0 designing it with future technologies in mind. The Framework’s been re-written in the next version of JS ES6 and Microsoft’s TypeScript. And it’ll only support browsers referred to as evergreen browsers that are continuously updating to the latest web standards. And it was written with developers in mind as well as front end UI designers.
The Great Migration
But with the release of this fully re-written framework, one constant stream of feedback from developers has been on the difficulty migrating from AngularJS 1.0 to 2.0.
The people who brought the world Angular have proposed a solution. They are enabling the mixing of Angular 1.0 and 2.0. The idea is to allow developers to seamlessly mix components and services from 2.0 with the earlier version. These services can be injected across a range of frameworks.
They can mix together and produce a single app. This solution offers an incremental migration to version 2.0. The app designers can chose those components of Angular 2.0 that they like or are convinced they’ll work well with the version 1.0 app.
But the Angular blog cautions certain conditions need to be met before this happens: the development team need to have dependency injection; component nesting; Transclusion and change detection, all interoperable between both versions. Additionally, the ng-upgrade library along with Angular 2.0 needs to be installed on the current app.
The ng-upgrade library allows services from the version 1.0 app to be injected into any version 2.0 components or services. This will facilitate the incremental migration of services from v 1.0 to v 2.0.
Important in making this migration possible is the nesting of Angular 1.0 components in version 2.0 and vice-versa. The ng-upgrade library can also facilitate this. It allows developers to wrap a component from one version in a facade and nest it in a component in the other version. Components upgraded to Angular 2.0, can benefit from all the advantages accruing with that version.
Developers can still use the current version of JS with Angular 2.0 but the blog does encourage users to at least try out the next version of JS which is ES6 or TypeScript. The reason being is that you can make gains in code navigation; automated refactoring in IDEs, development documentation and debugging.Angular users can use these next generation scripting languages but older code is still valid.
This mix ‘n’match approach is just one way to facilitate migration from version 1.0 to 2.0 of Angular. But the advantage of working on an open source platform is that problems like this can be solved by the user community, and that solution is usually of a better quality and has a speedier implementation.