angular 取路由参数进行判断

import { Location } from ‘@angular/common’
import {Router} from ‘@angular/Router’
constructor(private location:Location,private router:Router){
    router.events.pipe(filter((event)=>event instanceof NavigationEnd)).subscrible(event=>{
    event.url当前路由信息(不包含自动跳转的)
    event.urlAfterRedirects 当前路由详细信息(暂时自动跳转)
  })
} 

 

posted @ 2019-10-28 15:50  第一神坑  Views(694)  Comments(0Edit  收藏  举报