[英]Angular lazy load of child module is not working?
I have a child module called branch and I wanted to load it only when I navigate to '/branch' url but am getting below error 我有一个名为branch的子模块,我只想在导航到“ / branch” URL时才加载它,但出现错误以下
ERROR Error: Uncaught (in promise): TypeError: undefined is not a function
TypeError: undefined is not a function
at Array.map (<anonymous>)
at webpackAsyncContext ($_lazy_route_resource lazy namespace object:15)
Navigation is used with routerLink as below 导航与routerLink一起使用,如下所示
<button mat-raised-button color="accent" [routerLink]="['/branch']">View Branches</button>
app-routing-module.ts is: app-routing-module.ts是:
const routes: Routes = [
{ path: 'branch', loadChildren: './branch/branch.module#BranchModule' },
];
Branch Module is: 分支模块为:
@NgModule({
imports: [
CommonModule,
RouterModule.forChild([{
path: '', component: BranchComponent,
},
{
path: 'view/:id', component: ViewBranchComponent
}
])
],
declarations: [BranchComponent, ViewBranchComponent],
exports: [BranchComponent, ViewBranchComponent, RouterModule]
})
export class BranchModule { }
Please can someone advise what went wrong here 请有人能告诉我这里出了什么问题
看来你已经在你的app.module.here importe LazyLoad模块,请参阅相关的问题ROM Github
这里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.