【发布时间】:2016-03-17 05:42:30
【问题描述】:
问题是路由器参数显示在 URL 中,而我希望我的路由器参数不显示在 URL 中?
myComponent.ts
@RouteConfig([
{ path: '/routerOne/:myId', component: routerOne, name: "routerOne",useAsDefault: true},
{ path: '/routerTwo/:myId', component: routerTwo, name: "routerTwo"},
])
我的组件.html
<a [routerLink]="['routerOne',{myId:this.Id}]">RouterOne</a>
<a [routerLink]="['routerTwo',{myId:this.Id}]">routerTwo</a>
【问题讨论】:
-
我认为最好的方法是使用 sharedService !
-
能否如您所说的那样解释一下如何使用共享设备,如果您提供示例对我们来说会更好。