Different routes same component

后端 未结 4 1475
眼角桃花
眼角桃花 2021-01-01 12:06

I want to achieve something like this /products shows all the products and /products/:category shows all the products related to a specific categor

4条回答
  •  误落风尘
    2021-01-01 12:26

    You could also define a redirect to a specific path:

    { path: '**', redirectTo: '/home', pathMatch: 'full' },
    

    where /home is the route you want to redirect to.

    path: '**' resolves all paths which are not defined

提交回复
热议问题