1.路由监听

angular5 路由变化监听

angular5 路由变化监听

 

//监听路由变化
this.router.events
.filter(event => event instanceof NavigationEnd)
.map(() => this.activatedRoute)
.map(route => {
while (route.firstChild) route = route.firstChild;
return route;
})
.subscribe((event) => {
this.colorChange();
});

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-08-07
  • 2021-11-16
猜你喜欢
  • 2021-06-17
  • 2021-08-22
相关资源
相似解决方案