function
developer preview
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. You can enable/disable features by passing special functions (from the HydrationFeatures
set) as arguments to the provideClientHydration
function.
provideClientHydration(...features: HydrationFeature<HydrationFeatureKind>[]): EnvironmentProviders
features | HydrationFeature<HydrationFeatureKind>[] | Optional features to configure additional router behaviors. |
EnvironmentProviders
: A set of providers to enable hydration.
Basic example of how you can enable hydration in your application when bootstrapApplication
function is used:
bootstrapApplication(AppComponent, { 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 {}
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/platform-browser/provideClientHydration