BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Angular Offers Refined Migration Path with ng-upgrade

Angular Offers Refined Migration Path with ng-upgrade

This item in japanese

The Angular team has released more information on their plans to enable smooth migration from Angular 1 to Angular 2.

At ng-conf 2015, they said the new router would allow for an incremental upgrade, one view at a time. In the post, Brad Green said "The feedback we received was that while yes, [the new router] was incremental, it wasn't incremental enough. We went back and redesigned..."

Powering the new migration system will be a new component called ng-upgrade that handles interop in these areas:

  • Dependency injection
  • Component nesting
  • Transclusion
  • Change detection

Once the work on ng-upgrade is complete, developers will be able to mix and match Angular 1 and 2 services, components, and views. "The ng-upgrade library will automatically make all of the Angular 1 injectables available in Angular 2. This means that your Angular 1 application services can now be injected anywhere in Angular 2 components or services," said Green. Rather than relying on impaired emulation, both engines are present, each executing their respective pieces.

The end result of this work is that developers can migrate an application from Angular 1 to Angular 2 one piece at a time.

But, the new router is not dead. Green told InfoQ that a forthcoming developer's guide will go with the existing router API documentation.

The migration plan comes as good news to developers worried about starting new Angular 1 projects. User escobar said in a Hacker News discussion that he thinks the news is a good move:

I have been evaluating writing some new applications in Angular at work and was quickly turned away from it because before today the actual migration path seemed very unclear. Without a migration path, picking v1 for a new application at this point would be silly, and 2 is completely unready for production.

Green says they are planning more posts on migrations including a detailed guide with code samples. The team has also shared a design document that describes in more detail the strategy behind the new migration plan. The new ng-upgrade component is not yet available but should arrive as part of the Angular 2 Beta. While there is no set date for the beta, Green told InfoQ the following has to happen before they can release a beta:

  • No breaking changes for 4 weeks
  • Complete "sugaring" to make core APIs and tooling a great experience
  • First 20 or so sections of the Developer Guide are complete. 4 out of 20 are completed.

Rate this Article

Adoption
Style

BT