I am using an admin dashboard that has a file structure with authguard and all. I can create links with [routeLink] from templates fine but no matter which combination I try, I have failed to do from route.navigate (or naviateByUrl).
There is an excellent intro here on SO but am failing still. Not sure if the file structure is necessary but just to give any idea:
I have layouts module that contains routing directions:
{ path: 'logistics', loadChildren: './logistics/logistics.module#LogisticsModule' },
where logistics is a module within the layout module. Under it, there are several other componenets. I access them with localhost:4200/logistics/new
for e.g. to create a new logistic data. Now from that component, I want to navigate to
localhost:4200/logistics/print/2
where 2 is id of the new transaction to be printed. They are both within the same directory and parent route.
The following don't work:
this.route.navigate(['/logistics/print',2])
this.route.navigate(['logistics/print',2])
this.route.navigateByUrl('logistics/print/2')
I did come across { relativeTo: this.route } but I think I have failed to apply it properly as it made no difference.