I have Ride
组件,并在骑行结束时Ride Summary
显示。
右侧的摘要有一个“开始另一次骑行”按钮,该按钮会重定向到同一组件,Ride
.
[routerLink]="['Ride']"
自从Ride
组件已经是我所在的组件,它没有刷新并且Ride Summary
屏幕一直显示。
我如何重新初始化Ride
重新导航到该组件时? (再次使用ngOnInit方法)
Router
不导航,如果route
and params
没有改变,默认。
要使其导航,您可以定义
routerCanReuse(nextInstruction: ComponentInstruction,
prevInstruction: ComponentInstruction){
return false;
}
在你的组件中,你想要 renvaigate 并调用
Router.renavigate();
罢工>
this.router.navigate('RouteName', this.routeParams.params)
重新定位。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)