我得到了以下结构:Angular2如何直接导入一个懒加载模块?
+--AppModule
| +--OverviewModule
| | +--OtherModule1
| | +--OtherModule2
| | +--OtherModule3
要加载OverviewModule我使用延迟加载。这是我的AppModule航线配置:
const appRoutes: Routes = [
{
path: 'overview',
loadChildren: 'app/injus/views/overview.module#OverviewModule'
},
{
path: '',
redirectTo: 'overview',
pathMatch: 'full'
},
{
path: '**',
component: PageNotFoundComponent
}
];
当路径是'overview'
它显示我的概述模块。当路径为''
时,我希望它转到“概览”。不幸的是,这是行不通的。
概述路由:
export const overviewRoutes: Routes = [
{
path: '',
component: OverviewComponent,
children: [
{
path: '',
redirectTo: 'othermodule1',
pathMatch: 'full'
},
{
path: 'othermodule1',
loadChildren: 'app/injus/views/othermodule1/othermodule1.module#otherModule1'
},
{
path: 'othermodule2',
loadChildren: 'app/injus/views/othermodule2/othermodule2.module#2otherModule1'
},
{
path: 'othermodule3',
loadChildren: 'app/injus/views/othermodule2/othermodule3.module#3otherModule1'
}
]
}
];
我如何可以直接到延迟加载的模块?
在OverviewComponent中有' router-outlet>吗? –
是的,我有一个路由器插座 –