Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • As you can see here: stackoverflow.com/a/44865817/11442461 you specify required parameters. I ask for optional parameters. Commented Oct 5, 2021 at 14:38
  • Just updated answer. Corrected the router link and app route. Commented Oct 5, 2021 at 15:06
  • For a solution like your example, I need to know existence and value of p1. But I like to navigate on my location and add the parameter p2 without any other change on my location. If another function adds an additional parameter, I don’t like to touch the parameter. Do you understand the difference of my specification? Commented Oct 6, 2021 at 12:50
  • Using ActivatedRoute within the component, you can find the route path and parameters for the route,. Depending on existing parameters in the route, include the extra optional parameter not used in Router.Nagivate(..). Commented Oct 6, 2021 at 14:35
  • I have included the relativeTo routing option in the answer. Commented Oct 7, 2021 at 12:21