angular路由router

this.router.events
    .pipe(
        filter(event => event instanceof NavigationEnd),
        map(() => this.activatedRoute),
        map(route => {
          while (route.firstChild) route = route.firstChild;
          return route;
        }),
        filter(route => route.outlet === 'primary'),
        mergeMap(route => route.data)
    )
    .subscribe((event) => {
        // 更改页面title
        if(event["breadcrumb"]){
          this.toolbarNavMenuName = event["breadcrumb"];
          console.log( this.toolbarNavMenuName);
          //hide navside
          $('.navToggle').click();
          sessionStorage.setItem("toolbarNavMenuName", this.toolbarNavMenuName);
        }
    });

 

this.activatedRoute
    .queryParams
    .subscribe(params => {
      // Defaults to 0 if no query param provided.
      this.query = +params['pk'] || 0;

    });

 

posted @ 2020-11-16 15:23  jahoon  阅读(109)  评论(0)    收藏  举报