Angular: Find Full URL String of Sibling Component in Routerlink

159 views Asked by At

How do I find the full Url from a Router Link in Angular? I know how to navigate to a sibling component, however looking for the full url string, to store in variable .

Resources:

how to navigate from sibling component to another sibling component in Angular?

How do I navigate to a parent route from a child route?

1

There are 1 answers

0
Robert Dempsey On BEST ANSWER

You can do the following if you have the array of routes for your sibling route:

   this.router.serializeUrl(this.router.createUrlTree([...routes]))