我们有以下路由场景:
export const ROUTES: Routes = [
{
path: ':userId',
component: fromContainers.OrganizationComponent,
canActivate: [],
children: [
{ path: '', pathMatch: 'full', redirectTo: 'posts' },
{
path: 'posts',
loadChildren: './views/posts/posts.module#PostsModule'
}
]
}
];
我们的路由器存储无法识别userId
这种方式,但是当我们删除children
属性时,它确实识别userId
.
http://localhost:4200/user/r1RORssFG --> WORKS
http://localhost:4200/user/r1RORssFG/posts --> DOES NOT WORK
这种行为背后的原因是什么?