parent route angular code example
Example: how-do-i-navigate-to-a-parent-route-from-a-child-route
[routerLink]="['/absolute']"
[routerLink]="['../../parent']"
[routerLink]="['../sibling']"
[routerLink]="['./child']"
[routerLink]="['child']"
[routerLink]="['../../parent', {abc: 'xyz'}]"
[routerLink]="['../../parent']" [queryParams]="{p1: 'value', p2: 'v2'}" fragment="frag"
...
constructor(private router: Router, private route: ActivatedRoute) {}
...
this.router.navigate(["/absolute/path"]);
this.router.navigate(["../../parent"], {relativeTo: this.route});
this.router.navigate(["../sibling"], {relativeTo: this.route});
this.router.navigate(["./child"], {relativeTo: this.route});
this.router.navigate(["child"], {relativeTo: this.route});
this.router.navigate(["../../parent", {abc: 'xyz'}], {relativeTo: this.route});
this.router.navigate(["../../parent"], {relativeTo: this.route,
queryParams: {p1: 'value', p2: 'v2'}, fragment: 'frag'});
this.router.navigate(["../../parent"], {relativeTo: this.route, skipLocationChange: true});