routerLink 加载一个嵌套的页面 parent->child->child

routerLink to load a page of a nested parent->child->child

我正在尝试使用 routerLink 加载具有两个命名插座的 parent->child->child 路由器插座的页面。

 http://localhost:4200/#/output/(output:details/(data:distributions))

1) 如果我将 URL 粘贴到浏览器中,它就可以工作了

2) 如果我使用下面的方法:

this.router.navigateByUrl('output/(output:details/(data:distributions))');

如果我尝试在 angular2 选项卡组件中使用路由器 link 它不起作用

[routerLink]="['/output', {outlets: {'output': ['details'],'data':['distributions']}}]"

 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'output'

我的其他 link 只有 parent-> child 可以工作:

 [routerLink]="['/output', {outlets: {'output': ['scenarios']}}]"

我必须假设我为 parent->child->child.

设置的 routerLink 格式不正确

你可以这样做:

routerLink = [
  '/output', {outlets: {'output': ['details', {outlets: {'data': ['distributions']}}]}}
]);