Now that you understand how eager-loading of modules work, you will be able to better understand the code we are about to write, which may otherwise seem like black-magic, and magical (aka misunderstood) code always leads to spaghetti architectures.
We will now evolve the eager-loading solution to be a lazy-loading one. In order to load routes from a different module, we know we can't simply import them, otherwise they will be eagerly loaded. The answer lies in configuring a route using the loadChildren attribute with string informing the Router how to load a submodule in app-routing.module.ts:
- Ensure that any module you intend to lazy load is not imported in app.module
- Remove any routes added to ManagerModule
- Ensure that ...