我的应用中有两条路线
{path: 'activity/?cInfo=askjdfkajsdfkasd', component: PostComponent},
{path: 'activity/:id', component: PostDetailComponent}
我必须做些什么才能让它们工作?
带有查询字符串?cInfo=askjdfkajsdfkasd的路由应该转到PostComponent
和 Route 之类的活动/skjdfhakjdfhaajsdf应该转到PostDetailComponent
我试过
{path: 'activity/?cInfo=askjdfkajsdfkasd', component: PostComponent,canActivate:[CheckForListPage],pathMatch:'full'},
{path: 'activity/:id', component: PostDetailComponent,canActivate:[CheckForDetailPage]}
但每次调用 1。守卫返回布尔值。
角度是否像大多数 MVC 那样区分 queryParams 和 pathVariables?