在Angular 6中,如果嵌套的子路由未能渲染视图,可能是由于以下几个原因:
标签,它将用于渲染子组件的视图。const routes: Routes = [
{
path: 'parent',
component: ParentComponent,
children: [
{
path: 'child',
component: ChildComponent
}
]
}
];
Go to child route
标签。const routes: Routes = [
{
path: 'parent',
component: ParentComponent,
children: [
{
path: 'child',
component: ChildComponent,
children: [
{
path: 'grandchild',
component: GrandchildComponent
}
]
}
]
}
];
Go to grandchild route
确保按照以上步骤配置和使用子路由,以确保子路由能够正确渲染视图。