我創建一個嵌套的路線,並試圖從孩子的路由訪問使用參數和查詢的鏈接時,顯示爲的http://localhost:3000/test/test/TestingId;param1=value1
代替http://localhost:3000/test/test/TestingId?param1=value1
顯示的子URL查詢參數;而不是與
這裏是我的父路由定義:
@RouteConfig([
{path: '/', component: RootComponent, name: 'RootCmp' },
{path: '/test/...', component: NestedComponent, name: 'NestCmp', data: {isAdmin: true} }
])
@Component({
selector: 'main-app',
template:`
<h1>Using Router and Router Config</h1>
<a [routerLink]="['RootCmp']">Home</a> |
<a [routerLink]="['NestCmp']">Nested Route Test</a>
<router-outlet></router-outlet>
`,
directives: [ROUTER_DIRECTIVES, RouterLink]
})
我的孩子路由定義是這樣的:
@RouteConfig([
{path: '/', component: SecComponent, name: 'NestCmp', useAsDefault:true },
{path: '/test/:id', component: SecComponent, name: 'NestChildCmp', data: {isAdmin: true} },
])
@Component({
selector: 'child-app',
template:`
<h1>Using Router and Router Config</h1>
<a [routerLink]="['./NestCmp', {'param1': 'value1'}]">Nested Home</a> |
<a [routerLink]="['NestChildCmp', { 'id': 'TestingId', 'param1': 'value1'}]">Nested Route Test</a>
<router-outlet></router-outlet>
`,
directives: [ROUTER_DIRECTIVES, RouterLink]
})
似乎已知的問題。謝謝,關閉這個問題。 https://github.com/angular/router/issues/397 – Gary
https://www.w3.org/DesignIssues/MatrixURIs.html – Gary