RouterEvent

路由器相关事件的(而不是关于特定路由的)基类。对于任何指定的导航,RouterEvent 只会触发一次。

Base for events the Router goes through, as opposed to events tied to a specific Route. RouterEvents will only be fired one time for any given navigation.

查看"说明"...

      
      class RouterEvent {
  constructor(id: number, url: string)
  id: number
  url: string
}
    

说明

例子:

Example:

class MyService { constructor(public router: Router, logger: Logger) { router.events.pipe( filter(e => e instanceof RouterEvent) ).subscribe(e => { logger.log(e.id, e.url); }); } }
      
      class MyService {
  constructor(public router: Router, logger: Logger) {
    router.events.pipe(
      filter(e => e instanceof RouterEvent)
    ).subscribe(e => {
      logger.log(e.id, e.url);
    });
  }
}
    

构造函数

constructor(id: number, url: string)
      
      constructor(id: number, url: string)
    
参数
id number
url string

属性

属性说明
id: number 声明于构造函数中
url: string 声明于构造函数中