NG.VIII · Angular 22 practice question
A developer migrates a service to an Angular 22 zoneless application and keeps the following stability check. How does this.ngZone.isStable behave at runtime in zoneless mode?
import { Injectable, NgZone, inject } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class InitService {
private ngZone = inject(NgZone);
runIfReady() {
if (this.ngZone.isStable) {
this.initialize();
}
}
private initialize() {}
}
Check answer and explanation
Correct answer: It always evaluates to true, making it unsuitable as a condition for gating execution
Explanation
In a zoneless application, NgZone.isStable is always true and therefore should not be relied on as a conditional guard for executing code.
Common trap
Since NgZone observables stop emitting in zoneless mode, developers often assume isStable stays false, when in fact it is always true. NgZone.isStable still exists on NgZone without throwing, which is why stale conditional checks can silently run unconditionally unless removed.
Source: Angular docs: Angular without ZoneJS (Zoneless) — Remove `NgZone.onMicrotaskEmpty`, `NgZone.onUnstable`, `NgZone.isStable`, or `NgZone.onStable`
Checked against the cited text on 2026-11-25.