RouterEvent

From Get docs
< @angular/routerAngular/docs/8/api/router/routerevent


RouterEvent

class

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

  • GuardsCheckEnd
  • GuardsCheckStart
  • NavigationCancel
  • NavigationEnd
  • NavigationError
  • NavigationStart
  • ResolveEnd
  • ResolveStart
  • RoutesRecognized


See also

  • Event

Constructor

constructor(id: number, url: string)

Parameters
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.

Usage notes

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

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v8.angular.io/api/router/RouterEvent