W3cubDocs

/Angular

NavigationError

class final

An event triggered when a navigation fails due to an unexpected error.

class NavigationError extends RouterEvent {
  constructor(id: number, url: string, error: any, target?: RouterStateSnapshot)
  type: EventType.NavigationError
  error: any
  target?: RouterStateSnapshot
  toString(): string

  // inherited from router/RouterEvent
  constructor(id: number, url: string)
  id: number
  url: string
}

See also

Constructor

constructor(id: number, url: string, error: any, target?: RouterStateSnapshot)

Parameters
id number
url string
error any
target RouterStateSnapshot

The target of the navigation when the error occurred.

Note that this can be undefined because an error could have occurred before the RouterStateSnapshot was created for the navigation.

Optional. Default is undefined.

Properties

Property Description
type: EventType.NavigationError Read-Only
error: any Declared in Constructor
target?: RouterStateSnapshot Read-Only

The target of the navigation when the error occurred.

Note that this can be undefined because an error could have occurred before the RouterStateSnapshot was created for the navigation.

Methods

toString(): string

Parameters

There are no parameters.

Returns

string

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