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

岁酱吖の 提交于 2019-12-24 08:42:17

问题


I am trying to use routerLink to load a page of a parent->child->child router outlet with two named outlets.

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

1) If I paste the URL into the browser it works

2) If I use the below it works:

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

If I try to use router link in an angular2 tab component IT DOES NOT WORK

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

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

My other links that only have a parent-> child do work:

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

I have to assume I am formatting the routerLink incorrect for the parent->child->child.


回答1:


You can do it like this:

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


来源:https://stackoverflow.com/questions/44469288/routerlink-to-load-a-page-of-a-nested-parent-child-child

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!