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
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
<button mat-raised-button color="accent" [routerLink]="['/branch']">View Branches</button>
app-routing-module.ts is:
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
这里。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.