W3cubDocs

/Angular 11

NavigationBehaviorOptions

interface

Options that modify the Router navigation strategy. Supply an object containing any of these properties to a Router navigation function to control how the navigation should be handled.

interface NavigationBehaviorOptions {
  skipLocationChange?: boolean
  replaceUrl?: boolean
  state?: {...}
}

Child interfaces

See also

Properties

Property Description
skipLocationChange?: boolean

When true, navigates without pushing a new state into history.

// Navigate silently to /view
this.router.navigate(['/view'], { skipLocationChange: true });
replaceUrl?: boolean

When true, navigates while replacing the current state in history.

// Navigate to /view
this.router.navigate(['/view'], { replaceUrl: true });
state?: { [k: string]: any; }

Developer-defined state that can be passed to any navigation. Access this value through the Navigation.extras object returned from the Router.getCurrentNavigation() method while a navigation is executing.

After a navigation completes, the router writes an object containing this value together with a navigationId to history.state. The value is written when location.go() or location.replaceState() is called before activating this route.

Note that history.state does not pass an object equality test because the router adds the navigationId on each navigation.

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