Reputation: 215
There are many url paths, but they start with a specific string.
Is there a way to route using wildcards in this case?
Or is there a better way to be an alternative?
ex) sell-computer, sell-phone, ..., buy-computer, buy-phone, ...
path: 'market',
children: [
{
path: '',
pathMatch: 'full',
component: MarketComponent,
},
{
path: 'sell-**',
component: SellComponent
},
{
path: 'buy-**',
component: BuyComponent
}
],
},
Upvotes: 1
Views: 417
Reputation: 2171
I think you should pass the sell/buy type as param :
{
path: 'sell/:type',
component: SellComponent
},
{
path: 'buy/:type',
component: BuyComponent
}
or if you want to keep the structure :
{
path: 'sell-:type',
component: SellComponent
},
{
path: 'buy-:type',
component: BuyComponent
}
And then in you component get the param from the current route.
Upvotes: 2