provideClientHydration
Sets up providers necessary to enable hydration functionality for the application.
API
function provideClientHydration( ...features: HydrationFeature<HydrationFeatureKind>[] ): EnvironmentProviders;
HydrationFeature<HydrationFeatureKind>[]Optional features to configure additional hydration behaviors.
Description
Sets up providers necessary to enable hydration functionality for the application.
By default, the function enables the recommended set of features for the optimal performance for most of the applications. It includes the following features:
- Reconciling DOM hydration. Learn more about it here.
-
HttpClientresponse caching while running on the server and transferring this cache to the client to avoid extra HTTP requests. Learn more about data caching here. Incremental hydration. Learn more.
These functions allow you to disable some of the default features or enable new ones:
-
withNoHttpTransferCacheto disable HTTP transfer cache -
withHttpTransferCacheOptionsto configure some HTTP transfer cache options -
withI18nSupportto enable hydration support for i18n blocks -
withEventReplayto enable support for replaying user events -
withNoIncrementalHydrationto disable incremental hydration
Usage Notes
Basic example of how you can enable hydration in your application when bootstrapApplication function is used:
bootstrapApplication(App, {
providers: [provideClientHydration()]
});
Alternatively if you are using NgModules, you would add provideClientHydration to your root app module's provider list.
@NgModule({
declarations: [RootCmp],
bootstrap: [RootCmp],
providers: [provideClientHydration()],
})
export class AppModule {}
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/platform-browser/provideClientHydration