在使用此问题中的某些功能后:https://github.com/angular/angular/issues/13831
constructor(private router: Router){
// override the route reuse strategy
this.router.routeReuseStrategy.shouldReuseRoute = function(){
return false;
}
this.router.events.subscribe((evt) => {
if (evt instanceof NavigationEnd) {
// trick the Router into believing it's last link wasn't previously loaded
this.router.navigated = false;
// if you need to scroll back to top, here is the right place
window.scrollTo(0, 0);
}
});
}
“我的组件”不再显示来自后端的任何数据。我什至切换了git分支,似乎它到处都破坏了该组件。有什么问题吗?