Skip to content

Meaningful error messages #13

@andreElrico

Description

@andreElrico

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:

  1. comment out bootstrap argument in LAZY_MODULE decorator
  2. add LAZY_MODULE in app.module (root module)
  3. 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>
  1. Develop till perfect.
  2. Revert step 1 + 2,
  3. Comment out code of 3. You might need it for the next lazyModule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions