9

I have already an application which is build on angular 1.3.4 and I want to change it to angular 2 but module wise.

lets say I've 5 modules on my page I want to migrate one module to angular 2 and other should work as it is like before with 1.3 so slowly slowly I can convert but till that it should not stop working.

I include both angular 2 and angular 1.3.4 libraries and it saying angular is not defined in console

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Mohit Bumb
  • 2,466
  • 5
  • 33
  • 52
  • to be honest, I wouldn't suggest you to install yet another plugin like *ng-upgrade* which add even more complexity to your codebase. Instead, start isolating one module and migrate it as if were a single application with it's own services and routing. – pietro909 May 24 '16 at 07:20

1 Answers1

8

Please read this blog: http://angularjs.blogspot.nl/2015/08/angular-1-and-angular-2-coexistence.html

It explains how to run it together and how to finally upgrade to Angular 2.

The important thing of this link is:

For this to work, four things need to interoperate between Angular 1 and Angular 2:

  • Dependency injection
  • Component nesting Transclusion
  • Change detection

To make all this possible, we're building a library named ng-upgrade. You'll include ng-upgrade and Angular 2 in your existing Angular 1 app, and you'll be able to mix and match at will.

So you need ng-upgrade. See more information about that here: https://angular.io/docs/ts/latest/guide/upgrade.html

georgeawg
  • 48,608
  • 13
  • 72
  • 95
C. Molendijk
  • 2,614
  • 3
  • 26
  • 35