Standalone mechanism for dynamic import of widget feature modules
See original GitHub issueπ feature request
Relevant Package
?
Description
There are cases where we need to be able to lazy-load components from a module that may not fit into a router paradigm; for instance, a component that gets loaded into a popover as a menu button is clicked (this is the exact scenario Iβm facing).
Describe the solution youβd like
There are third-party solutions such as hero-loader
that solve this problem, but a built-in solution would be preferred, especially since there shouldnβt much additional code beyond the routerβs implementation to make this happen with dynamic imports in a reusable way. Please provide some kind of directive that could be placed on an ng-container
that would allow me to target a module, and preferably a component within it. Alternatively, the boostrapped component approach done by hero-loader
could be acceptable when thereβs one and only one expected component available.
Describe alternatives youβve considered
hero-loader
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top GitHub Comments
@chris13524 Read, for example, this article: https://medium.com/angular-in-depth/lazy-load-components-in-angular-596357ab05d8
If I understand your issue you would like to load a component lazy but to do so now requires you to load the module and that get the factory from there. The steps are non-trivial. With ivy a simple
import(...)
will work just fine.