我很难弄清楚为什么TEST 1孩子没有加载当前组件
在我路由到Test1ChildComponent后,会显示Test1ListComponent视图。URL 更改,但Test1ChildComponent视图未加载
路由树:
应用程序路由模块
const routes: Routes = [
{
path: '',
pathMatch: 'full'
},
{
path: 'app',
loadChildren: './core/core.module#CoreModule'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
核心路由模块
const routes: Routes = [
{
path: '',
redirectTo: '/',
pathMatch: 'full'
},
{
path: 'test1',
loadChildren: '../test1/test1.module#Test1Module'
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class CoreRoutingModule { }
test1-routing.module
const routes: Routes = [
{
path: '',
redirectTo: 'test1',
pathMatch: 'full'
},
{
path: '',
component: Test1ListComponent,
data: {
displayName: 'Test1'
},
children: [
{
path: 'test1/:testId',
component: Test1ChildComponent,
data: {
displayName: 'Test1Child'
},
children: [
{
path: 'test2/:testId',
component: Test2hildComponent,
data: {
displayName: 'Test2Child'
}
}
]
}
]
},
];