After a long search, I found one solution that allows me to redirect the parent directly from the child.
What I used is TypeScript $ routeConfig for routing between component below
this.$routeConfig = [ { path: '/', name: 'listofitemsanddetails', component: 'myitemlist', useAsDefault: true }, { path: '/:id/info', name: 'itemdetails', component: 'listitenmdetail' }];
But this will not allow me to redirect to itemdetails
from a child of another component, and then I tried to use $router.parent.navigate(['listofitems']);
which is in the grandparent
my application, and then I added some redict logic to itemdetails
in the standard route ( listofitems
) of the grandparent component, which is redirected to the listofitemsanddetails
component by listofitemsanddetails
.
source share