[英]how to load lazy component with angular without ngModule?
In angular is it possible to load component in lazy without specify ngModule
?在 angular 中是否可以在不指定
ngModule
的情况下以惰性方式加载组件?
Today I use:今天我使用:
{ path: '..', loadChildren: () => import('./my.module').then(m => m.myModule) }
Can I do something like this code:我可以做这样的代码:
{ path: '..', component: () => import('./my.component') }
Is it possible?可能吗? if so how?
如果是这样怎么办?
I found this tutorial which I think can help you.我找到了这个教程,我认为它可以帮助你。 In order, you need to declare the component as part of this module, then to load component only when it's used, helped by ComponentFactoryResolver and Injector
按照顺序,您需要将组件声明为该模块的一部分,然后仅在使用组件时才加载组件,由ComponentFactoryResolver和Injector提供帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.