我正在尝试使用routerLink加载具有两个命名插座的父>子>子路由器插座的页面。
http://localhost:4200/#/output/(output:details/(data:distributions))
1(如果我将URL粘贴到浏览器中,它可以工作
2(如果我使用以下方法,它可以工作:
this.router.navigateByUrl('output/(output:details/(data:distributions))');
如果我尝试在 angular2 选项卡组件中使用路由器链接,它不起作用
[routerLink]="['/output', {outlets: {'output': ['details'],'data':['distributions']}}]"
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'output'
我的其他只有亲>子的链接确实有效:
[routerLink]="['/output', {outlets: {'output': ['scenarios']}}]"
我必须假设我为父>子>子格式化路由器链接不正确。
你可以
这样做:
routerLink = [
'/output', {outlets: {'output': ['details', {outlets: {'data': ['distributions']}}]}}
]);