W3cubDocs

/Angular

withExperimentalPlatformNavigation

Enables interop with the browser's Navigation API for router navigations.

API

function withExperimentalPlatformNavigation(): ExperimentalPlatformNavigationFeature;

Description

CRITICAL: This feature is highly experimental and should not be used in production. Browser support is limited and in active development. Use only for experimentation and feedback purposes.

This function provides a Location strategy that uses the browser's Navigation API. By using the platform's Navigation APIs, the Router is able to provide native browser navigation capabilities. Some advantages include:

  • The ability to intercept navigations triggered outside the Router. This allows plain anchor elements without RouterLink directives to be intercepted by the Router and converted to SPA navigations.
  • Native scroll and focus restoration support by the browser, without the need for custom implementations.
  • Communication of ongoing navigations to the browser, enabling built-in features like accessibility announcements, loading indicators, stop buttons, and performance measurement APIs.

NOTE: Deferred entry updates are not part of the interop 2025 Navigation API commitments so the "ongoing navigation" communication support is limited.

Usage Notes

const appRoutes: Routes = [
  { path: 'page', component: PageComponent },
];

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter(appRoutes, withExperimentalPlatformNavigation())
  ]
});

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/router/withExperimentalPlatformNavigation