Let's presume I got this router config
export const EmployeeRoutes = [
{ path: 'sales', component: SalesComponent },
{ path: 'contacts', component: ContactsComponent }
];
and have navigated to the SalesComponent
via this URL
/department/7/employees/45/sales
Now I'd like to go to contacts
, but as I don't have all the parameters for an absolute route (e.g. the department ID, 7
in the above example) I'd prefer to get there using a relative link, e.g.
[routerLink]="['../contacts']"
or
this.router.navigate('../contacts')
which unfortunately doesn't work. There may be an obvious solution but I'm not seeing it. Can anyone help out here please?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…