子模块的角度惰性负载不工作



我有一个名为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)

导航与routerLink一起使用,如下

<button mat-raised-button color="accent" [routerLink]="['/branch']">View Branches</button>

app-routing-module.ts是:

const routes: Routes = [
{ path: 'branch', loadChildren: './branch/branch.module#BranchModule' },
];

分支模块是:

@NgModule({
imports: [
CommonModule,
RouterModule.forChild([{
path: '', component: BranchComponent,
},
{
path: 'view/:id', component: ViewBranchComponent
}
])
],
declarations: [BranchComponent, ViewBranchComponent],
exports: [BranchComponent, ViewBranchComponent, RouterModule]
})
export class BranchModule { }

请有人告诉这里出了什么问题

您似乎已将LazyLoad模块导入到您的app.Module中。此处,请参阅Github中的相关问题。

最新更新