我有一个订阅路由器事件的服务如下:
this.router.events.filter(e => e instanceof RoutesRecognized)
.subscribe(event => {
if(event.urlAfterRedirects !== "/my/other/page") {
this.router.navigate(['/my/other/page']);
}
});
然后当我从我的页面重定向到一个页面时, 我看到了这些事件:
NavigationStart ("/my/first/page")
RoutesRecognized ("/my/first/page")
NavigationCancelled
NavigationStart ("/my/other/page")
RoutesRecognized ("/my/other/page")
NavigationEnd ("/my/other/page")
在我的浏览器上,网址更改为/my/other/page
但页面内容未更新且没有错误
请问有什么不对?