【发布时间】:2018-09-16 05:03:48
【问题描述】:
我有这个角度为 5 的示例路线。这 3 个组件被导入到这个模块中。组件mark在john组件文件夹下生成,james组件在mark组件文件夹下生成。
我想通过如下所示的路径加载 james 组件:https://my-website/john-route/mark-route/james-route 所以我在模块文件中创建了这个路由。
const routes: Routes = [
{
path: 'john-route',
component: JohnComponent,
children: [
{
path: 'mark-route',
component: MarkComponent,
children: [
{
path: 'james-route',
component: JamesComponent
}
]
}
]
}
];
但我的问题是,它只加载到带有这个[routerLink]="['mark-route']" 的标记组件。
在带有此[routerLink]="['james-route']" 的詹姆斯组件上,它仅在URI 中显示正确的路径https://my-website/john-route/mark-route/james-route,但不会在页面中加载该组件。这里发生了什么,如何解决这个问题或最好的解决方案是什么?
【问题讨论】:
标签: angular routes angular5 router