Angular——路由跳转/传参/监听路由

∥☆過路亽.° 提交于 2019-12-11 00:48:23

 constructor(

    private router: Router,

private route: ActivatedRoute,

) {

}

if (event instanceof NavigationEnd) {
        if (this.route.snapshot.queryParams.id) {
          this.queryList.FileId = this.route.snapshot.queryParams.id;
          this.queryList.Offset = 0;
        } 
      }

 

 

this.router.navigate(['home/document/pulicDoc'], {queryParams: {id: res}});
this.isDocument =  this.router.events.subscribe((event: Event) => {
      if (event instanceof NavigationEnd) {
        this.fileActive = event.url.indexOf('pulicDoc') >= 0 || event.url.indexOf('proDoc') >= 0;
      }
    });
    this.unSpace = this.userSpaceService.spaceChange$.subscribe(res => {
      this.getUserInfO();
    });
  }
ngOnDestroy() {
    this.unSpace.unsubscribe();
    if(this.isDocument) {
      this.isDocument.unsubscribe();
    }
  }

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!