我想延迟加载模块与子路由声明在它的路由配置文件, 懒惰模块加载成功,但我不能导航到它的子路由。如何导航到延迟加载的模块子路由?
我正在使用这种技术,就好像它是一个热切加载的模块。 我宣布道路,里面是儿童。 请参阅Plunker中的'moduleB'路由文件 链接按钮正尝试导航到子路由并加载CmpC。但它失败了。
这里是我的根模块路由decalration:
{ path: 'feature-b', loadChildren:'src/featureB/featureB.module#FeatureBModule' , pathMatch: 'full'}
这是我懒加载模块路由声明。
export const moduleBRoutes: Routes = [
{ path: '', component:CmpC , pathMatch: 'full',children:[
{path: '' , pathMatch: 'full'},
{ path: 'c', component:CmpB , pathMatch: 'full'}
]},
];
export const subRouting: ModuleWithProviders = RouterModule.forChild(moduleBRoutes);
试图导航到:本地主机:999 /功能-B成功
试图导航到:本地主机:999 /功能-B/C失败
https://plnkr.co/edit/wFlJoDXRmAlMOswmwWFk?p=preview
它正在工作你的运动员,但在我的环境。我得到 错误:无法匹配任何路线:'feature-b/c' 有什么想法? – almog
请仔细检查plunke。如果它在笨重的工作,它会在你的环境中工作。 – micronyks