NG.II · Angular 22 practice question
A developer is implementing a complex side effect using `afterRenderEffect`. They need to ensure that subsequent phases correctly receive the output from the preceding phase's callback. Which characteristic of the effect execution flow must they rely on?
import { afterRenderEffect, signal } from '@angular/core';
const dataSignal = signal(1);
afterRenderEffect(() => {
// Phase 1
const result1 = dataSignal();
return result1 * 2; // This return value feeds the next phase
});
Check answer and explanation
Correct answer: The return value of a phase's callback is automatically passed as a Signal input to the next phase's callback.
Explanation
The mechanism where a phase's callback output automatically feeds into the subsequent phase's Signal input is the correct description of how the effect phases operate sequentially.
Common trap
The assertion that only the `earlyRead` phase can yield a value affecting later execution stages is inaccurate, as the documentation clarifies that `earlyRead` only receives the cleanup function, not a return value that dictates subsequent phase behavior.
Source: Angular docs: Effects — Render phases
Checked against the cited text on 2026-11-25.