• 概要
@angular/router

withViewTransitions

function

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

API

function withViewTransitions(
  options?: ViewTransitionsFeatureOptions | undefined,
): ViewTransitionsFeature;

withViewTransitions

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

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.

@paramoptionsViewTransitionsFeatureOptions | undefined

Description

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

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.

Usage Notes

Basic example of how you can enable the feature:

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