[英]Setting up nested/child route in Angular 2 router
Setting up some nested routing that should look like mypage/param1/1/param2/2 in the URL. 设置一些嵌套的路由,其外观应类似于URL中的mypage / param1 / 1 / param2 / 2。 The 1 is the first parameter, and the 2 is the second parameter.
1是第一个参数,而2是第二个参数。 There should always be two parameters, otherwise there should be an error.
始终应该有两个参数,否则应该有一个错误。 This isn't working for me yet.
这对我来说还行不通。 Am I on the right track here?
我在正确的轨道上吗?
{
path: 'param1/:param1',
component: PageNotFoundComponent,
children: [
{ path: 'param2/:param2', component: SomeComponent },
]
}
This worked: 这工作:
{
path: 'param1/:param1',
children: [
{ path: 'param2/:param2', component: SomeComponent },
]
}
There's only one component that handles both variables. 只有一个组件可以处理两个变量。 Errors will occur if you define a component for 'group/:groupID'.
如果为“ group /:groupID”定义组件,则会发生错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.