我有一个名为 branch 的子模块,我只想在导航到“/branch”网址时才加载它,但出现以下错误
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 { }
请有人可以告诉这里出了什么问题