给Angular的模块加上懒加载之后, 本地服务器可以导航到各个模块的页面,但是构建出来之后放到服务器上,虽然出现两个模块的chunk.js也对应加载完成了,但是路由并不会跳转。
路由配置如下
app-routing.module.ts
const routes: Routes = [
{ path: 'report', loadChildren: 'app/uxreport/uxreport.module#UxreportModule', canActivate: [AuthGuard2]},
{ path: '', redirectTo: 'charts/0', pathMatch: 'full'},
{ path: 'usability', loadChildren: 'app/usability/usability.module#UsabilityModule', canActivate: [AuthGuard2] },
{ path: 'charts', component: ChartViewComponent},
{ path: 'configuration', component: ConfigurationComponent, canActivate: [AuthGuard]},
{ path: '**', component: Page404Component }
];
uxreport-routing.module.ts
慕码人2483693
相关分类