Navigate relative with Angular 2 Router (Version 3)

After doing some more research I came across with

this.router.createUrlTree(['../step2'], {relativeTo: this.activatedRoute});

and

this.router.navigate(['../step2'], {relativeTo: this.activatedRoute});

First approach (Router.createUrlTree API) did not work for me, i.e. nothing happened. Second approach (Router.navigate API) works.

Update 2016-10-12

There is another stackoverflow question as well:

  • How do I navigate to a sibling route

Update 2016-10-24

Documentation:

  • Routing & Navigation (Relative Navigation)

Update 2019-03-08

It seems that there were changes in Angular 7.1. There is an answer in another post how to solve it with Angular 7.1. Please refer to https://stackoverflow.com/a/38634440/42659.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)