【发布时间】:2019-01-05 03:37:44
【问题描述】:
我试图了解命名插座在 8 月 6 日是如何工作的。我希望能够将一个页面分成多个部分,并让该页面根据路由路径配置提供的多个命名插座动态显示不同的内容。我没有看到任何调试信息,也找不到问题所在。
例子:
app.component.html
<!--<app-basic></app-basic> -->
<router-outlet></router-outlet>
<h1>hello</h1>
<router-outlet name="sidebar"></router-outlet>
路由器模块我有以下:
{
path: 'schedule-inspection',
component: ScheduleInspectionComponent,
children:
[
{
path: 'add',
component: SidebarScheduleInspectionComponent,
outlet: 'sidebar',
},
],
},
结果是页面正在加载父组件,并显示 hello。没有内容显示在指定的出口之外。
您应该能够做到这一点似乎是合乎逻辑的。如果您在此处使用路由器以外的其他方法,请告知,但这似乎是我正在尝试做的正确方法。
【问题讨论】:
-
你在点击 url schedule-inspection/add
标签: angular angular6 router-outlet