Reputation: 3771
Passing ints as path parameters is done like
const appRoutes: Routes = [
{
path: 'servers/:id',
component: ServerDetailComponent
}]
export const routing = RouterModule.forRoot(appRoutes);
but how do I do the same with :id
being a string
? So that I could navigate the servers object, say, by name
, instead of id
, like /servers/sqlserver
Upvotes: 1
Views: 937
Reputation: 8911
You can send strings the same way as numbers. It makes no difference between strings or numbers.
path: 'servers/:name',
Upvotes: 1