📜  获取上一个 url angular - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:32.889000             🧑  作者: Mango

代码示例2
// private router: Router//inject
    this.router.events
    .pipe( filter(        (evt:any)=>evt instanceof RoutesRecognized),pairwise())
    .subscribe((events: RoutesRecognized[]) =>{        
        console.log('previous',events[0].urlAfterRedirects);//previous url
        console.log('current url',events[1].urlAfterRedirects);//current url
      }    );