1

I've seen a bunch of answers about how to pass multiple path params when the params are next to each other in the url, for example user/:userId/:postId, however in my router I have a route defined as user/:userId/post/:postId. How do I target this route using router.navigate()?

I tried to do this.router.navigate(['user', userId, postId]); but this results in matching the catch-all '**' path.

1 Answer 1

2

You were pretty close, put post(string) in between userId & postId

this.router.navigate(['user', userId, 'post', postId]);
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.