W3cubDocs

/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.

API

function withPreloading(
  preloadingStrategy: Type<PreloadingStrategy>,
): PreloadingFeature;

Usage Notes

Basic example of how you can configure preloading:

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

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/withPreloading