Enabling Full Hydration
Turn on hydration to avoid re-rendering.
Enabling Full Hydration is a free Angular Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Turning On Hydration
Full hydration is enabled by adding provideClientHydration() to your application providers. The ng add @angular/ssr schematic adds it for you.
import { provideClientHydration } from '@angular/platform-browser';
export const appConfig = {
providers: [provideClientHydration()]
};Where It Goes
It belongs in the browser appConfig providers, the same config used to bootstrap the client. The server config merges on top with provideServerRendering().
What Full Means
Full (eager) hydration hydrates the entire component tree as soon as the JavaScript loads and Angular boots. Every component becomes interactive at once.
Event Replay
Enable withEventReplay() so user interactions that happen before hydration completes are captured and replayed afterward, preventing lost clicks on slow devices.
import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
providers: [provideClientHydration(withEventReplay())]HTTP Transfer Cache
With hydration on, HttpClient GET responses from the server are cached into TransferState by default, so the client does not refetch the same data after boot.
provideClientHydration(withHttpTransferCacheOptions({ filter: r => r.method === 'GET' }))Verifying Hydration
Open the console in dev mode. Angular logs hydration stats (components hydrated, nodes reused). No mismatch warnings means hydration succeeded cleanly.
// Angular hydrated 24 component(s) and 187 node(s)Fixing Mismatches
If you see NG0500 mismatch errors, find non-deterministic templates or manual DOM edits. Make markup deterministic so server and client outputs agree.
Guard Browser APIs
Code that touches window or localStorage during initial render can change markup between server and client. Guard with isPlatformBrowser or run it after view init.
if (isPlatformBrowser(this.platformId)) {
this.width = window.innerWidth;
}Full Hydration Tradeoff
Full hydration is simple but downloads and executes all component JavaScript up front. For large apps this can delay interactivity, which incremental hydration addresses.
i18n And Hydration
Hydration works with Angular i18n, but ensure translated content is deterministic. Mismatched locales between server and client cause hydration errors.
Production Check
Before shipping, build for production, serve the SSR output, and confirm in the network and console that hydration runs without mismatches and the transfer cache prevents double fetches.
Quick Check
Check your full hydration knowledge.
Recap
You enabled full hydration with provideClientHydration(), added withEventReplay() for pre-hydration clicks, relied on the HTTP transfer cache, guarded browser APIs, and verified clean hydration. Full hydration is simple but loads all JS up front.
Frequently asked questions
Is the “Enabling Full Hydration” lesson free?
Yes — the full text of “Enabling Full Hydration” is free to read here on the web, and the Angular Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Angular Academy course, upgrade to CoddyKit PRO.
What will I learn in “Enabling Full Hydration”?
Turn on hydration to avoid re-rendering. You practise Angular Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Angular Academy?
No prior experience is required. Angular Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Enabling Full Hydration” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Angular Academy lesson?
Yes. Every Angular Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Is Hydration
- Enabling Full Hydration
- Incremental Hydration with @defer
- Measuring Core Web Vitals