I'm using Angular (4) with the @angular/router and want to be able to have optional parameters in a path style.
I currently have this:
{ path: 'cars', component: CarComponent },
{ path: 'cars/:type', component: CarComponent },
{ path: 'cars/:type/:brand', component: CarComponent },
{ path: 'cars/:type/:brand/:id', component: CarComponent },
This works but what I'm looking for is an optional parameter in :type. The type can either be 'new' or empty so ' ' and the empty part is the one that seems hard to do because Angular doesn't know what the context is.
Help would be appreciated