Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

NavigationError

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