1

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

1 Answer 1

1

You can send strings the same way as numbers. It makes no difference between strings or numbers.

path: 'servers/:name',
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.