NG.III · Angular 22 practice question
A developer implements a component that loads a heavy widget only when a user's subscription status becomes 'premium'. This widget is wrapped in an `@defer` block using a `when` trigger. If the user later downgrades their account, what will happen to the loaded widget?
<div *ngIf="isPremium()">
@defer (when "isPremium()") {
<heavyWidget />
} @placeholder {
Loading...
}
</div>
Check answer and explanation
Correct answer: The widget will remain visible, as the initial successful loading state is permanent once the 'when' condition is met.
Explanation
The widget will remain visible because the initial successful loading state is permanent once the 'when' condition is met.
Common trap
Suggesting that the widget will automatically unload and revert to the 'Loading...' placeholder because the condition is now false contradicts the one-time nature of the trigger. Stating that the widget will only load if the condition is true at the moment the view is initialized, regardless of subsequent state changes, is too vague and does not capture the specific behavior of the trigger.
Source: Angular docs: Deferred loading with `@defer` — `when`
Checked against the cited text on 2026-11-25.