我在angular 7中使用了延迟加载概念。我创建了带有sidemenu的项目。在侧边菜单中路由页面时,出现“未捕获(承诺):错误:加载块modulename-module失败”错误。但是
app-routing.module.ts
const routes: Routes = [
{ path: '', redirectTo:'login', pathMatch: 'full' },
{ path: 'parent', loadChildren: './layout/layout.module#LayoutModule'},
{ path: 'login', component: LoginComponent}
];
layout-routing.module.ts
const routes: Routes = [
{
path: '',
component: LayoutComponent,
children: [
{ path: 'dashboard', loadChildren: '../dashboard/dashboard.module#DashBoardModule'},
{ path: 'test', loadChildren: '../test/test.module#TestModule'},
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' }
]
}
];
layout.component.ts,
navItems: NavItem[] = [
{
displayName: 'TEST',
iconName: 'speaker_notes',
route: 'test',
children: [
{
displayName: 'Bulk Download',
iconName: 'cloud_download',
route: 'parent/test'
}]
}
]
在侧面菜单中的“测试”导航中,我在这里遇到错误。
任何人的帮助将不胜感激!