On this page
RouterEvent
class  final 
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
}
   Subclasses
See also
Description
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): e is RouterEvent => e instanceof RouterEvent)
    ).subscribe((e: RouterEvent) => {
      // Do something
    });
  }
}
   Constructor
        
          | 
      
id | 
            number | 
            A unique ID that the router assigns to every router navigation.  | 
           
url | 
            string | 
            The URL that is the destination for this navigation.  | 
           
Properties
| Property | Description | 
|---|---|
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.  | 
      
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v14.angular.io/api/router/RouterEvent