当尝试通过浏览器或使用window.location.reload刷新当前路由时。应用程序导航回到主页(登录页面)。它应该重新加载相同的URL。我们尚未在应用程序中使用身份验证保护。尽管使用了LocationStrategy,但使用了HashLocationStrategy。
const currentUrl = window.location.href;
const vizUrl = currentUrl.split('#')[1];
this.router.navigateByUrl('/',{ skipLocationChange: true }).then(() =>
{ this.router.navigate([vizUrl]); });
vizUrl是我们要重新加载/刷新的路线