{ "id": "api/router/RouterEvent", "title": "RouterEvent", "contents": "\n\n
\n
\n
\n \n API > @angular/router\n
\n \n
\n \n
\n

RouterEventlink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

Base for events the router goes through, as opposed to events tied to a specific\nroute. Fired one time for any given navigation.

\n\n

See more...

\n
\n \n \n \n
\n\nclass RouterEvent {\n constructor(id: number, url: string)\n id: number\n url: string\n}\n\n\n \n \n
\n

Subclasseslink

\n \n\n\n\n\n
\n \n\n
\n\n\n \n
\n

See alsolink

\n \n
\n\n\n \n \n
\n

Descriptionlink

\n

The following code shows how a class subscribes to router events.

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

Constructorlink

\n\n\n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n \n\n constructor(id: number, url: string)\n\n \n\n
Parameters
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n id\n number\n

A unique ID that the router assigns to every router navigation.

\n \n
\n \n url\n string\n

The URL that is the destination for this navigation.

\n \n
\n\n \n\n\n \n\n \n
\n
\n\n\n\n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n id: number\n \n Declared in Constructor\n

A unique ID that the router assigns to every router navigation.

\n\n \n
\n \n url: string\n \n Declared in Constructor\n

The URL that is the destination for this navigation.

\n\n \n
\n
\n\n\n\n\n\n \n\n\n
\n
\n\n\n" }