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.

withViewTransitions

Enables view transitions in the Router by running the route activation and deactivation inside of document.startViewTransition.

See more...

      
      withViewTransitions(options?: ViewTransitionsFeatureOptions): ViewTransitionsFeature
    
Parameters
options ViewTransitionsFeatureOptions

Optional. Default is undefined.

Returns

ViewTransitionsFeature: A set of providers for use with provideRouter.

See also

Description

Note: The View Transitions API is not available in all browsers. If the browser does not support view transitions, the Router will not attempt to start a view transition and continue processing the navigation as usual.

Further information is available in the Usage Notes...

Usage notes

Basic example of how you can enable the feature:

      
      const appRoutes: Routes = [];
bootstrapApplication(AppComponent,
  {
    providers: [
      provideRouter(appRoutes, withViewTransitions())
    ]
  }
);