const routes: Routes = [
{
path: 'parent',
component: ParentComponent,
children: [
{ path: '', pathMatch: 'full', redirectTo: 'child' },
{ path: 'child', component: ChildComponent },
{ path: 'grandchild', component: GrandchildComponent }
]
}
];
元素,用于显示子组件:Parent Component
元素来支持嵌套的子路由:Child Component
这样子路由就能正常工作并显示在父路由组件的
内容区域中了。