Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular :: Link to parent 'router-outlet' from a nested outlet

Tags:

angular

routes

I have a component within a nested router-outlet, but would like to create a link to a route that is in the parent's router-outlet. I am not sure what code you guys would want to see for me to explain this?

like image 716
Brian B Avatar asked Jan 22 '26 02:01

Brian B


1 Answers

I was not able to do it from the template (maybe seeing this answer someone could show me the way to do it from the template), but I was able to make it work by navigating programmatically like this:

this.router.navigate(['../../account-view/' + id], { relativeTo: this.route.parent });
like image 64
Brian B Avatar answered Jan 23 '26 17:01

Brian B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!