0

I have been trying to use ng-upgrade as an upgrade strategy to angular2 with limited success, I have successfully added an angular2 app and downgraded it's components, but the implementation is not very flexible.

I get an error saying

ReferenceError: MainModule is not defined

It seems like UpgradeAdapter must be instantiated in the same file as the angular2 module declaration - which is a problem when introducing multiple, separate modules with independent downgrades.

I guess my question is... is it the correct way to utilize UpgradeAdapter and if so is there a way to separate the adapter definition and the module definition into separate files?

plnkr demonstrating the issue: https://embed.plnkr.co/ZPw9BVBVSZjYbfzkAkpl/

Avi Farada
  • 681
  • 2
  • 7
  • 15

1 Answers1

0

I followed the bootstrap sequence until I found the issue, it turns out that there were 2 mistakes in my plnkr:

  • Angular 1 - The ng1 app template used "module-1-component" & "module-2-component" as the downgraded components selector, but it was actually "module1-component" & "module2-component", I misunderstood the camelCase to kebab-case conversion in ng1.
  • Angular 2 - The ng2 module declarations had "declares" property instead of "declarations".

Updated plnkr demonstration the solution: https://embed.plnkr.co/6gljurzSWWiuk8QHvLFw/

Hope this helps!

Avi Farada
  • 681
  • 2
  • 7
  • 15