NG.VIII · Angular 22 practice question

In a Zone-based app, a developer initializes a third-party charting library inside ngZone.runOutsideAngular and attaches a click handler to the chart. When the user clicks the chart, why does that click handler execute outside the Angular zone?

Choose one answer
Check answer and explanation

Correct answer: Because the chart's initialization logic was also executed outside the Angular zone

Explanation

The event callback runs outside the Angular zone because the initialization logic that registered it was also called outside the Angular zone.

Common trap

Without runOutsideAngular, Zone.js patches browser APIs so third-party listeners often do execute inside the Angular zone and cause zone pollution. NgZone.isInAngularZone() is a read-only check that reports whether code is inside the Angular zone; it does not change the active zone.

Source: Angular docs: Resolving zone pollution — Run tasks outside `NgZone`
Checked against the cited text on 2026-11-25.

Report an error in this question