NG.I · Angular 22 practice question
A developer is building a custom component that must reflect a value passed down from its parent. They use `input()` to define the property. Which statement accurately describes how this input value can be accessed within the child component's logic?
import {Component, input, computed} from '@angular/core';
@Component({selector: 'app-slider'})
export class CustomSlider {
sliderValue = input(10);
displayLabel = computed(() => `Current: ${this.sliderValue()}`);
}
Check answer and explanation
Correct answer: The value must be accessed by invoking the signal function, e.g., `this.sliderValue()`.
Explanation
To retrieve the data from a signal established using the `input()` function, one must invoke the signal as a callable function, matching the pattern shown in `this.sliderValue()` and consistent with the official documentation for reading input signals.
Common trap
Treating the signal as a direct property, such as accessing it via `this.sliderValue`, is incorrect for signals. Furthermore, assuming that Angular automatically unwraps the input signal, allowing access like `this.sliderValue.value`, is a misunderstanding of how Angular's input signals operate.
Source: Angular docs: Accepting data with input properties — Reading inputs
Checked against the cited text on 2026-11-25.