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.

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

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

说明

Example:

例子:

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

构造函数

constructor(id: number, url: string)

参数

id

Type: number.

url

Type: string.

属性

属性名类型说明
id声明于构造函数中
url声明于构造函数中