RouterEvent
Class
stable
Base for events the router goes through, as opposed to events tied to a specific route. Fired one time for any given navigation.
constructor
RouterEvent@paramid
numberA unique ID that the router assigns to every router navigation.
@paramurl
stringThe URL that is the destination for this navigation.
@returns
RouterEventid
numberA unique ID that the router assigns to every router navigation.
url
stringThe URL that is the destination for this navigation.
Description
Base for events the router goes through, as opposed to events tied to a specific route. Fired one time for any given navigation.
The following code shows how a class subscribes to router events.
import {Event, RouterEvent, Router} from '@angular/router';class MyService { constructor(public router: Router) { router.events.pipe( filter((e: Event | RouterEvent): e is RouterEvent => e instanceof RouterEvent) ).subscribe((e: RouterEvent) => { // Do something }); }}
Jump to details