I want to access a component's routing URL that is not the current url and store it in a service. So basically if my component is parentComponent
and has childComponent
then the URL of the child component is
/parentComponent/childComponent
If I navigate to the above URL and call this.router.url
in parentComponent
's ngOnInit
then it correctly returns /parentComponent/childComponent
. How do I get just /parentComponent
, i.e. the route to the component itself, from the router within the parent component?