angular - How do I navigate to a sibling route? - Stack Overflow
Update 08/02/2019 Angular 7.1.0
current route: /department/7/employees/45/sales
the old version will do: /department/7/employees/45/sales/contacts
As per @KCarnaille's comment the above does not work with the latest Router. The new way is to add .parent
to this.r
so
// Working(08/02/2019)
goToContact() {
this.router.navigate(["../contacts"], { relativeTo: this.r.parent });
}
the update will do: /department/7/employees/45/contacts
Không có nhận xét nào:
Đăng nhận xét