When ANYTHING goes wrong in the lazy module when "attaching" the module, I get the same error message:
ERROR Error: Uncaught (in promise): Error created and attaching module async.
For example I forgot to provide Service1 that is injected in a component and therefore get the "injector cant resolve ..." error. This error is also reflected as: ERROR Error: Uncaught (in promise): Error created and attaching module async. which makes it hard to debug.
The obvious workaround is to develop the module EGERLY and then lazyload the finished product.
Is there any other solution ?
Workaround im currently using:
- comment out
bootstrap argument in LAZY_MODULE decorator
- add LAZY_MODULE in app.module (root module)
- add code somewhere in
app.component.html
<button style="position: absolute;" #b1 value="1" (click)="b1.value = b1.value == 1 ? 0 : 1;">RELOADER BTN</button>
<div *ngIf="b1.value == 1" style="position: absolute; background-color: #FFCCDA; top: 7em; right: 0; left: 0; bottom: 0;">
<app-MyBootstrapComponent></app-MyBootstrapComponent>
</div>
- Develop till perfect.
- Revert step 1 + 2,
- Comment out code of 3. You might need it for the next lazyModule.
When ANYTHING goes wrong in the lazy module when "attaching" the module, I get the same error message:
For example I forgot to provide
Service1that is injected in a component and therefore get the "injector cant resolve ..." error. This error is also reflected as:ERROR Error: Uncaught (in promise): Error created and attaching module async.which makes it hard to debug.The obvious workaround is to develop the module EGERLY and then lazyload the finished product.
Is there any other solution ?
Workaround im currently using:
bootstrapargument in LAZY_MODULE decoratorapp.component.html