Question presented to candidate:
"List the kinds of data binding Angular templates support, say which direction each one goes, and explain what [(ngModel)] actually expands to."
What a strong answer should cover:
- Interpolation
{{ }}: component to text, always escaped (safe against HTML injection). - Property binding
[prop]: component to a DOM property (not an HTML attribute). - Attribute, class and style bindings:
[attr.x],[class.x],[style.x]for things that are not properties, or for single classes and styles. - Event binding
(event): DOM or component events to a handler, with$eventas the payload. - Two-way binding
[(x)]: sugar for[x]plus(xChange), which works with a writable signal or a field. - The direction model: one-way by default, two-way only where you write it; property versus attribute is the classic trap.
Clarifying questions expected:
- "Do you also want how this works with signals, or the template syntax only?"
Code / implementation expected: Yes — one template using every binding type, plus what the compiler turns it into.