Question presented to candidate:
"Modern Angular components declare input(), model() and output() instead of decorators. Explain what signal inputs and model() are, and how you decide which one a given property should be."
What a strong answer should cover:
- A signal input (
input()) is a read-only signal: the parent writes it through a binding, the child only reads it. - A model input (
model()) is a writable signal that is also an input plus an output named<name>Change, so the parent can bind it with[(name)]. - The decision is about ownership: parent owns it (input), child and parent share it (model), child only reports an event (output).
- Derived values from either are
computed(); neither needsngOnChanges. - A local, resettable copy of an input is
linkedSignal, not a model. - Both were developer preview in 17.x and are stable since v19.
Clarifying questions expected:
- "Should the parent always know the current value, or only be told when the user commits a change?"
Code / implementation expected: Yes β a small child with one input() and one model(), bound from a parent.