RouterEvent
路由器相关事件的(而不是关于特定路由的)基类。对于任何指定的导航,RouterEvent 只会触发一次。
Base for events the router goes through, as opposed to events tied to a specific route. Fired one time for any given navigation.
      
      class RouterEvent {
  constructor(id: number, url: string)
  id: number
  url: string
}
    参见
构造函数
      
      参数
  | 
属性
| 属性 | 说明 | 
|---|---|
 id: number | Declared in constructor. A unique ID that the router assigns to every router navigation.  | 
 url: string | Declared in constructor. The URL that is the destination for this navigation.  | 
使用说明
      
      class MyService {
  constructor(public router: Router, logger: Logger) {
    router.events.pipe(
       filter((e: Event): e is RouterEvent => e instanceof RouterEvent)
    ).subscribe((e: RouterEvent) => {
      logger.log(e.id, e.url);
    });
  }
}