SSR and hydration: Angular 22 practice questions
SSR and hydration is 6% of the free Angular 22 mock (3 of 50 questions). Pick an answer to see right away whether it is correct, with the explanation and the documentation section it comes from.
NG.IX · Angular 22 practice question
A developer adds a hydrate on clause inside an Angular @defer block. What does the hydrate on clause control?
Check answer and explanation
Correct answer: The condition under which client-side hydration is triggered for that @defer block.
Explanation
In incremental hydration, hydrate on defines the condition that determines when hydration is triggered for that specific @defer block.
Common trap
Assuming hydrate on schedules server-side execution confuses SSR rendering with client-side hydration—the server renders the block up front while hydrate on controls when the client hydrates it. Linking hydrate on to disabling event replay is tempting because event replay is part of incremental hydration, yet hydrate on only specifies the hydration trigger condition.
Source: Angular docs: Incremental Hydration — `hydrate on`
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
Given this Angular 22 component used in an SSR application, how does Angular execute the callback passed to afterNextRender?
import { Component, afterNextRender } from '@angular/core';
@Component({
selector: 'app-viewport-tracker',
template: '<p>Viewport ready</p>',
})
export class ViewportTrackerComponent {
constructor() {
afterNextRender(() => {
console.log(window.innerWidth);
});
}
}
Check answer and explanation
Correct answer: Angular skips the callback during server rendering and executes it only in the browser.
Explanation
Lifecycle hooks such as afterNextRender and afterEveryRender are skipped on the server and run exclusively in the browser, making them safe places to call browser-only APIs like window.
Common trap
Expecting Angular to supply a mocked window object on the server is tempting if you are used to browser-emulation test runners, but Angular skips afterNextRender entirely during SSR instead of mocking browser globals. Thinking window causes a compile error in SSR projects is wrong because Angular allows browser symbols inside browser-only hooks like afterNextRender.
Source: Angular docs: Server and hybrid rendering — Authoring server-compatible components
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
An architect is explaining how Angular's incremental hydration works under the hood. Which three existing Angular capabilities does incremental hydration build upon?
Check answer and explanation
Correct answer: Full-application hydration, deferrable views, and event replay.
Explanation
Incremental hydration builds directly on top of full-application hydration, deferrable views (@defer blocks), and event replay.
Common trap
Standalone components, TransferState, and route preloading are real Angular features often used alongside SSR, which makes them tempting, but they are not the three foundations incremental hydration builds on. Signals, Zone-based change detection, and service workers are likewise unrelated to the core trio of full hydration, deferrable views, and event replay.
Source: Angular docs: Incremental Hydration — How does incremental hydration work?
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A developer configures Angular server routing so that public product pages render per request on the server while an internal admin dashboard renders strictly in the browser. Which API lets the developer assign these per-route strategies?
Check answer and explanation
Correct answer: The RenderMode setting inside the server routing configuration to choose between Server (SSR) and Client (CSR).
Explanation
Angular server routing lets you configure how individual routes render by specifying RenderMode, choosing Server (SSR) for per-request server HTML generation or Client (CSR) for browser rendering.
Common trap
Setting a hydrationStrategy property on the browser Router sounds plausible because routes are defined there, but per-route rendering modes belong to the server routing configuration via RenderMode. Configuring environment.renderTarget in angular.json is tempting because build options live there, yet Angular controls route rendering modes through RenderMode in server routing rather than a build flag.
Source: Angular docs: Server and hybrid rendering — Rendering modes
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
During server-side rendering, an Angular 22 app uses HttpClient with the default fetch backend to download a 2.5 MB JSON catalog from an API, and the request fails. What caused the failure?
Check answer and explanation
Correct answer: Angular caps each SSR HttpClient fetch response body at 1 MB by default and throws error NG02825 when exceeded.
Explanation
When HttpClient uses the default fetch backend during SSR, Angular caps each response body at 1 MB by default and fails with error NG02825 if a response exceeds that size.
Common trap
Assuming the fetch backend cannot parse JSON during SSR is a tempting guess when requests fail on the server, but fetch is the default SSR backend and handles JSON normally within size limits. Blaming a 256 KB TransferState cap sounds plausible because TransferState serializes data into HTML, yet the actual default limit is 1 MB on the response body itself.
Source: Angular docs: Server and hybrid rendering — Configuring the response body size limit
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A team enables hydration on an SSR app that embeds a third-party charting widget performing direct DOM manipulation. Given this template, why did the developer add ngSkipHydration?
<app-legacy-chart ngSkipHydration />
Check answer and explanation
Correct answer: To exempt that component from hydration when direct DOM manipulation cannot yet be replaced with Angular constructs.
Explanation
Direct DOM manipulation breaks hydration unless it is rewritten using Angular constructs or bypassed with ngSkipHydration on the affected component.
Common trap
Thinking ngSkipHydration prevents server rendering is a frequent mix-up, because the attribute only skips client-side hydration for that component rather than disabling SSR. Treating ngSkipHydration as a lazy-loading trigger is tempting due to its name, yet bundle deferral is handled by @defer blocks rather than ngSkipHydration.
Source: Angular docs: Hydration — Verify that hydration is enabled
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A developer enables SSR on an existing Angular component that reads navigator.language and location.pathname inside its constructor. Why does this break server-side rendering?
Check answer and explanation
Correct answer: Browser-specific globals such as navigator, location, window, and document are not available in the server environment.
Explanation
Browser-specific globals such as navigator, location, window, and document (along with certain HTMLElement properties) are not available on the server, so accessing them directly during SSR causes errors.
Common trap
Moving the reads from the constructor to ngOnInit is a common misconception, because ngOnInit also executes during server-side rendering where those browser globals still do not exist. Believing the compiler strips navigator and location is tempting, yet Angular does not remove them—runtime execution on the server simply lacks those browser APIs.
Source: Angular docs: Server and hybrid rendering — Authoring server-compatible components
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A team moves a data-heavy storefront from client-side rendering to server-side rendering in Angular 22. Why do users typically experience faster initial page loads after this change?
Check answer and explanation
Correct answer: The server builds and sends HTML on each request instead of waiting for browser scripts to download, execute, and make extra data calls.
Explanation
Server-side rendering improves initial load speed because the server builds and sends HTML on each request instead of waiting for browser scripts to download, execute, and make extra data calls. Users only wait for the server to gather data and produce the page.
Common trap
Compiling templates into WebAssembly sounds like a plausible performance optimization, but Angular SSR delivers standard rendered HTML rather than WebAssembly modules. Caching API payloads in browser local storage at build time is tempting as a latency-reduction idea, yet SSR still fetches data on the server per request and does not pre-populate browser storage.
Source: Angular docs: Server and hybrid rendering — Rendering modes
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
An online magazine relies heavily on organic search traffic and adopts Angular server-side rendering for its article routes. What makes SSR especially effective for search engine optimization?
Check answer and explanation
Correct answer: Search crawlers receive an already-rendered HTML document containing the page content rather than an empty shell.
Explanation
SSR strengthens SEO because search crawlers receive an already-rendered HTML document containing the page content rather than an empty shell, allowing them to index the markup right away.
Common trap
Automatic XML sitemap generation is a common SEO task, but Angular SSR does not automatically create or submit sitemaps to search engines. Stripping JavaScript bundles for crawler user agents sounds like a clever optimization, yet SSR achieves strong SEO simply by serving fully rendered HTML to incoming requests.
Source: Angular docs: Server and hybrid rendering — Rendering modes
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A performance audit shows an Angular app with full application hydration still ships a heavy initial JavaScript bundle. What key benefit does adopting incremental hydration provide?
Check answer and explanation
Correct answer: It shrinks initial bundle sizes while preserving a comparable user experience, helping lower First Input Delay (FID) and Cumulative Layout Shift (CLS).
Explanation
Incremental hydration builds on full application hydration to produce smaller initial bundles while delivering a comparable end-user experience, which speeds up initial loads and reduces First Input Delay (FID) and Cumulative Layout Shift (CLS).
Common trap
Claiming incremental hydration replaces SSR with client-side caching is backwards because incremental hydration works together with SSR HTML. Saying it eliminates the Angular runtime or full application hydration is a common misconception—incremental hydration specifically builds on top of full application hydration.
Source: Angular docs: Incremental Hydration — Why use incremental hydration?
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
An SSR application hangs before stabilizing, and the developer relies on provideStabilityDebugging to diagnose the issue. How does this utility surface diagnostic feedback?
Check answer and explanation
Correct answer: It logs diagnostic details to the console whenever the application takes longer than expected to become stable.
Explanation
provideStabilityDebugging helps pinpoint stability issues by logging diagnostic details to the console when the application takes longer than expected to stabilize.
Common trap
Expecting an interactive browser overlay is tempting because some dev tools render overlays, but provideStabilityDebugging outputs its information to the console. Assuming it cancels pending timers or requests confuses a debugging utility with a timeout mechanism—it only reports why stability is delayed.
Source: Angular docs: Hydration — Debugging Application Stability
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
An SSR route legitimately needs to fetch a 3 MB payload using HttpClient with the default fetch backend. How should the developer raise the allowed response size?
Check answer and explanation
Correct answer: Configure maxResponseBodySize in the provideServerRendering options.
Explanation
To permit larger responses during server rendering, configure maxResponseBodySize in the provideServerRendering options so the server allows payloads beyond the default 1 MB cap.
Common trap
Passing a custom maxBodyBytes header on HttpClient.get() seems convenient for per-request overrides, but Angular does not recognize that header for SSR buffering limits. Setting responseSizeLimit inside provideClientHydration is tempting because hydration pairs with SSR, yet this limit is a server-rendering concern configured in provideServerRendering.
Source: Angular docs: Server and hybrid rendering — Configuring the response body size limit
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
Given this template in an Angular 22 app with incremental hydration enabled, what does Angular render during server-side rendering?
@defer (hydrate on idle) {
<app-product-reviews />
} @placeholder {
<p>Loading reviews...</p>
}
Check answer and explanation
Correct answer: Angular loads the defer block's dependencies on the server and renders the main template (<app-product-reviews />) instead of the @placeholder.
Explanation
Adding a hydrate trigger to a @defer block instructs Angular to load that block's dependencies during SSR and render its main template (<app-product-reviews />) rather than the @placeholder.
Common trap
Rendering only the @placeholder during SSR is how a standard @defer block without a hydrate trigger behaves, making it a very tempting trap. Rendering both the placeholder and the main template hidden by CSS is incorrect because Angular chooses the main template instead of the placeholder during SSR.
Source: Angular docs: Incremental Hydration — How does incremental hydration work?
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A developer uses provideClientHydration in an Angular 22 app and wants stability debugging active in a production build to investigate a slow-stabilizing route. What must the developer do?
Check answer and explanation
Correct answer: Add provideStabilityDebugging manually to the application providers, since it is only included by default in dev mode.
Explanation
While provideStabilityDebugging is provided by default in dev mode when using provideClientHydration, you must add it manually to the application providers to use it in production bundles (or in SSR apps without hydration).
Common trap
Assuming provideClientHydration keeps stability debugging on in production is tempting because it works automatically in dev mode, but default registration applies only to development builds. Looking for an angular.json flag is plausible for build-time toggles, yet Angular exposes provideStabilityDebugging as a standard provider function you register manually.
Source: Angular docs: Hydration — Debugging Application Stability
Checked against the cited text on 2026-11-25.
NG.IX · Angular 22 practice question
A developer wants a non-critical sidebar in a @defer block to hydrate once the browser has spare cycles, while still guaranteeing hydration happens if the main thread stays busy. Which statement accurately describes hydrate on idle?
Check answer and explanation
Correct answer: It triggers hydration when the browser is idle and supports an optional timeout.
Explanation
The hydrate on idle trigger starts hydration when the browser becomes idle and supports an optional timeout so hydration does not wait indefinitely.
Common trap
Hydrating on a user click describes an interaction-based trigger rather than hydrate on idle, and hydrate on idle does accept an optional timeout. Hydrating when scrolled into view describes a viewport trigger rather than idle, and the timeout on hydrate on idle is optional rather than mandatory.
Source: Angular docs: Incremental Hydration — `hydrate on`
Checked against the cited text on 2026-11-25.