.agent/skills/reference-signal-forms/references/integration.md
This document explains how the Signal Forms system hooks into the Angular compiler and runtime to provide seamless type-checking and efficient updates.
The packages/compiler-cli package contains specific logic to support [formField]. This is primarily handled in src/ngtsc/typecheck/src/ops/signal_forms.ts.
ɵNgFieldDirective property or comes from @angular/forms/signals.<input [formField]="mySignal" />, the type checker doesn't just check formField. It synthetically expands this into a set of bindings for validation:
[value]="mySignal()" (or checked for checkboxes)[disabled]="mySignal.disabled()"[required]="mySignal.required()"mySignal (the FieldNode) has all the necessary properties to drive the form control.[formField], you are banned from also binding [value], [disabled], [required], etc., as the signal form should be the single source of truth.<input type="checkbox"> requires a boolean signal).value input/output) or "Form Checkbox Control" (has a checked input/output) and validates against that.packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.ts: The core logic for TcbNativeFieldOp and SignalFormFieldOp.The packages/core package provides the low-level instructions that power the FormField directive. This allows it to do things normal directives cannot, like efficiently syncing state without change detection overhead for every property.
ɵngControlCreate Hook: The FormField directive defines a special method ɵngControlCreate.ɵɵcontrol Instructions: When the compiler sees ɵngControlCreate, it emits:
ɵɵcontrolCreate: Called during the creation phase.ɵɵcontrol: Called during the update phase.ControlDirectiveHost: These instructions provide the directive with a ControlDirectiveHost. This is a privileged interface that allows the FormField directive to:
value input of a custom control).valueChange).packages/core/src/render3/instructions/control.ts: Implementation of ɵɵcontrol instructions.packages/forms/signals/src/directive/form_field_directive.ts: The directive that implements the hook.