Example used is given in this stackblitz
This is how routing is structured
RouterModule.forRoot([
{
path: 'login',
component: LoginViewComponent,
children: [
{ path: 'home', component: HomeViewComponent },
{ path: 'catalog/:id', component: CatalogViewComponent }
]
},
{ path: '**', redirectTo: 'login' }
])
],
When I am in the login component, I can go to home component with this absolute route
this.navigate(['login/home']);
I can also use navigateByUrl() like this
this.navigateByUrl(['login/home']);
But I don't understand how to route relatively with navigate()
this.navigate(['home'], { relativeTo: this.route });
this.navigate(['/home'], { relativeTo: this.route });
None of these methods are routing to homeComponent