'Downgrading multiple Angular modules to AngularJS

I've got an existing AngularJS application, which is component based and loads different addons/plugins lazily using ocLazyLoad. I'm trying to write a new addon in Angular and downgrade the module and the components, pack the output into a single .js file and load it into the AngularJS app. It works fine with one downgraded addon. Then I started working on another addon, again in Angular and downgraded. Both addons work fine if only one of them is loaded at a time. However if I load both, I start getting strange errors in the console and only the addon that was loaded first works.

Unhandled Promise rejection: R3InjectorError(AppModule)[NgZone -> NgZone -> NgZone]: NullInjectorError: No provider for NgZone! ; Zone: ; Task: Promise.then ; Value: NullInjectorError: R3InjectorError(AppModule)[NgZone -> NgZone -> NgZone]: NullInjectorError: No provider for NgZone! at NullInjector.get (core.js:11120:1) at R3Injector.get (core.js:11287:1) at R3Injector.get (core.js:11287:1) at R3Injector.get (core.js:11287:1) at NgModuleRef$1.get (core.js:25352:1) at NgAdapterInjector.get (static.js:976:1) at downgradeFn (static.js:777:1) at static.js:786:1 at static.js:611:1 at Array.forEach () NullInjectorError: R3InjectorError(AppModule)[NgZone -> NgZone -> NgZone]: NullInjectorError: No provider for NgZone!

I'm wondering if someone has already done that and if there is something I'm missing here.

Both addons export modules with different names, and the belonging components are registered in the corresponding module, e.g. downgradeComponent('directiveName', { component: TheComponent, downgradedModule: theResultFromDowngradeModuleFn})



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source