我在角度路由中有两个url定义。
http://localhost:4200/user/:id/:mode-> component1和 http://localhost:4200/user/:id/preview-> component2
如果我调用http://localhost:4200/user/1/edit或http://localhost:4200/user/1/view,它将打开具有给定ID和给定模式参数的component1。到目前为止还可以。
但是,如果我致电http://localhost:4200/user/1/preview,我想转到component2。 但是路由模块将我路由到“预览”模式的component1。
那么关于如何解决这种路由冲突的任何建议?
br
答案 0 :(得分:1)
与订单有关,将预览移至:模式
之前children: [
{ path: 'preview', component: component2},
{ path: ':mode', component: component1},
]