NG.III · Angular 22 practice question
A developer is building a dashboard widget that contains a complex charting component. They want this chart to load instantly as soon as the rest of the dashboard renders, rather than waiting for user interaction or a delay. Which directive configuration should they use?
@defer (on immediate) {
<chart-component />
} @placeholder {
<div>Loading chart...</div>
}
Check answer and explanation
Correct answer: @defer (on immediate) { <chart-component /> } @placeholder { <div>Loading chart...</div> }
Explanation
The configuration '@defer (on immediate) { <chart-component /> }' instructs the framework to load the deferred content as soon as all other non-deferred content has finished rendering.
Common trap
Using 'on timer(0ms)' is functionally similar but is not the explicit trigger for immediate rendering, and using 'on hover' would only load it upon mouse interaction.
Source: Angular docs: Deferred loading with `@defer` — `on`
Checked against the cited text on 2026-11-25.