我创建一个嵌套的路线,并试图从孩子的路由访问使用参数和查询的链接时,显示为的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