我正在尝试这样做:
通常,我们在routing.ts中添加一个像这样的惰性模块,
{路径:“ taskCenter”,loadChildren:“ ./ taskCenter / taskCerter.module#TaskCenterModule'},
现在,我想从汇总或ng-packagr产生的包中加载Child动态!动态!
例如:Aot构建之后,当url为'localhost:4200 /#/ taskCenter'时,它将动态加载assetCenter.umd.js及其资产文件夹中的子模块
首先,我们如何将所有惰性模块打包到库中? 那么,如何动态加载该模块?
// First, in Library ,how to package all code including TestChildrenModule
@NgModule({
imports: [
RouterModule.forChild([
{
path: '', pathMatch: 'full', component: ModuleaComponent
},
{ path: 'aa', loadChildren: './test-children/test-children.module#TestChildrenModule' }
])
],
declarations: [ModuleaComponent],
exports: [ModuleaComponent]
})
export class ModuleaModule { }
此链接可能会有所帮助:https://github.com/lmeijdam/angular-umd-dynamic-example