This is the archived documentation for Angular v5. Please visit angular.io to see documentation for the current version of Angular.

RouterEvent

npm Package @angular/router
Module import { RouterEvent } from '@angular/router';
Source router/src/events.ts

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.

Example:

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

Overview

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

Subclasses

Constructor

      
      constructor(id: number, url: string)
    

Members

      
      id: number
    

      
      url: string