RouterEvent
路由器相关事件的(而不是关于特定路由的)基类。对于任何指定的导航,RouterEvent
只会触发一次。
Base for events the Router goes through, as opposed to events tied to a specific Route. RouterEvent
s 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);
});
}
}
构造函数
属性
属性 | 说明 |
---|---|
id: number | 声明于构造函数中 |
url: string | 声明于构造函数中 |