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.

withPreloading

Allows to configure a preloading strategy to use. The strategy is configured by providing a reference to a class that implements a PreloadingStrategy.

      
      withPreloading(preloadingStrategy: Type<PreloadingStrategy>): PreloadingFeature
    
Parameters
preloadingStrategy Type<PreloadingStrategy>

A reference to a class that implements a PreloadingStrategy that should be used.

Returns

PreloadingFeature: A set of providers for use with provideRouter.

See also

Usage notes

Basic example of how you can configure preloading:

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