如何在Angular 6中重新加载/刷新当前页面?

时间:2019-05-07 07:27:34

标签: angular

  

调用isRefresh()函数时,重新加载或刷新当前页面。

2 个答案:

答案 0 :(得分:0)

可以,

window.location.reload()

答案 1 :(得分:0)

这不是通常处理事物的正确方法,但是可以解决您的问题:

constructor(private router: Router){};
// Custom refresh code
reloadWindow() {
    this.router.navigateByUrl(`/`).then(
            () => {this.router.navigateByUrl(this.router.url);});
}
相关问题