Angular Forms: Reactive, Template-Driven and Signal Forms
Why this matters
Section titled “Why this matters”Forms are where an application meets its users, and they are where most of the accidental complexity in a front end accumulates. Angular now offers three form systems, which is one more than most teams have a considered opinion about — and picking the wrong one for a given screen produces either boilerplate you did not need or a structure that cannot express what you need.
This page is about choosing well, and about the parts of each system that people get wrong once they have chosen.
The three systems at a glance
Section titled “The three systems at a glance”| Signal Forms | Reactive Forms | Template-Driven | |
|---|---|---|---|
| Source of truth | A writable signal you define | FormControl / FormGroup tree |
Component properties |
| Type safety | Inferred from your model | Explicit, via typed forms | Minimal |
| Validation | Schema of path-based validators | Validator lists on controls | Directives in the template |
| State model | Signals | Observables | Angular-managed |
| Setup | Signal plus a schema function | Build a control tree | ngModel in the template |
| Learning curve | Medium | Medium–high | Low |
| Status | Stable from v22 | Stable | Stable |
| Best for | New signal-based applications | Complex and dynamic forms | Simple forms |
Signal Forms require Angular v21 or higher and are stable from v22.
Choosing
Section titled “Choosing”- Signal Forms — new signal-based applications, where you want types inferred from the model and validation gathered in one schema.
- Reactive Forms — complex or dynamic forms, existing reactive codebases, teams that want fine-grained control and observable-based patterns, and anywhere you need the longest production track record.
- Template-Driven — genuinely simple forms: a login box, a contact form, a search field. Prototyping. Existing template-driven code.
Angular’s own framing is worth quoting because it is more measured than the hype: “Signal Forms work best in new applications built with signals. If you’re working with an existing application that uses reactive forms, or if you need production stability guarantees, reactive forms remain a solid choice.”
Do not migrate a working reactive form to Signal Forms for its own sake.
The mental model: where does the value live?
Section titled “The mental model: where does the value live?”That one question separates the three systems, and everything else follows from it.
Reactive Forms: the control tree is the truth.
readonly loginForm = new FormGroup({ email: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.email] }), password: new FormControl('', { nonNullable: true, validators: [Validators.required] }),});
const credentials = this.loginForm.value;The form model is explicit, lives in the class, and the template binds to it. Data flow is synchronous in both directions: typing updates the control immediately; setValue updates the input immediately.
Template-Driven: the component property is the truth.
email = '';<input name="email" [(ngModel)]="email" required email />NgModel creates and manages a FormControl behind the scenes. Data flow is asynchronous model-to-view — NgModel queues the control update in ngOnChanges and it lands on the next tick, deliberately, to avoid ExpressionChangedAfterItHasBeenChecked. That asynchrony is precisely why template-driven forms are harder to test.
Signal Forms: a signal is the truth.
readonly loginModel = signal({ email: '', password: '' });
readonly loginForm = form(this.loginModel, (path) => { required(path.email, { message: 'Email is required' }); email(path.email, { message: 'Enter a valid email address' }); required(path.password);});<input type="email" [formField]="loginForm.email" /><input type="password" [formField]="loginForm.password" />form() returns a field tree mirroring the model’s shape. Each node is both navigable (loginForm.email) and callable (loginForm.email() returns a FieldState). Types are inferred from the model, so loginForm.username is a compile error without you declaring anything twice.
Reactive Forms in practice
Section titled “Reactive Forms in practice”Type it properly
Section titled “Type it properly”readonly form = new FormGroup({ email: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.email] }), age: new FormControl<number | null>(null), tags: new FormArray<FormControl<string>>([]),});Two things do most of the work here.
nonNullable: true stops reset() setting the control to null and removes null from the type. Without it, form.value.email is string | null | undefined and every consumer needs a guard. The NonNullableFormBuilder (inject(FormBuilder).nonNullable) applies it across a whole form.
form.value is a Partial. Disabled controls are excluded from value, so TypeScript types it with every property optional. When you need the whole thing — on submit, typically — use getRawValue(), which includes disabled controls and is fully typed.
Validators
Section titled “Validators”export function matchesField(other: string): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => control.value === control.parent?.get(other)?.value ? null : { mismatch: true };}A validator returns null for valid and an error object for invalid. Put cross-field validators on the group, not the control — a control-level validator that reaches up through control.parent runs before the parent exists during construction, which is a genuinely confusing undefined.
Async validators go in the third position and set pending while they run:
new FormControl('', { validators: [Validators.required], asyncValidators: [uniqueEmailValidator(inject(UserApiClient))], updateOn: 'blur',});updateOn: 'blur' for anything that hits the network. The default is 'change', which fires a request per keystroke.
FormArray for dynamic fields
Section titled “FormArray for dynamic fields”readonly lines = new FormArray<FormGroup<LineForm>>([]);
addLine(): void { this.lines.push(new FormGroup({ sku: new FormControl('', { nonNullable: true, validators: [Validators.required] }), quantity: new FormControl(1, { nonNullable: true, validators: [Validators.min(1)] }), }));}
removeLine(index: number): void { this.lines.removeAt(index);}<div formArrayName="lines"> @for (line of lines.controls; track line; let i = $index) { <fieldset [formGroupName]="i"> <input formControlName="sku" /> <input type="number" formControlName="quantity" /> <button type="button" (click)="removeLine(i)">Remove</button> </fieldset> }</div>Note track line — tracking the control object rather than $index. With $index, removing an item from the middle re-associates every subsequent DOM node with a different control, and the user watches their inputs shuffle.
Reactive forms and change detection
Section titled “Reactive forms and change detection”One sharp edge that catches people moving to zoneless: reactive forms model updates do not schedule change detection. setValue, patchValue, FormArray.push and friends update form state and emit on the form’s observables, but they do not notify Angular that a view needs refreshing.
If a template depends on reactive-forms state, connect it explicitly — pipe through the AsyncPipe, call ChangeDetectorRef.markForCheck() in a subscription, or mirror the value into a signal:
readonly status = toSignal(this.form.statusChanges, { initialValue: this.form.status });See Change Detection and Zoneless Angular.
Template-Driven Forms in practice
Section titled “Template-Driven Forms in practice”<form #f="ngForm" (ngSubmit)="save(f)"> <label for="email">Email</label> <input id="email" name="email" type="email" [(ngModel)]="model.email" required email #emailCtrl="ngModel" />
@if (emailCtrl.invalid && emailCtrl.touched) { <p class="error"> @if (emailCtrl.errors?.['required']) { Email is required. } @if (emailCtrl.errors?.['email']) { Enter a valid email address. } </p> }
<button type="submit" [disabled]="f.invalid">Save</button></form>Three requirements that produce most template-driven bugs:
nameis mandatory.NgModelregisters with the parentNgFormbyname. Without it you get a runtime error, or a control silently missing fromf.value.- Export the directive to reach its state.
#emailCtrl="ngModel"gives youvalid,touched,errors. Without the export,#emailCtrlis the DOM element. FormsModulemust be imported by the standalone component.
Custom validation needs a directive, not a function — that is the fundamental cost of template-driven forms:
@Directive({ selector: '[skuFormat]', providers: [{ provide: NG_VALIDATORS, useExisting: SkuFormatDirective, multi: true }],})export class SkuFormatDirective implements Validator { validate(control: AbstractControl): ValidationErrors | null { return /^[A-Z]{3}-\d{4}$/.test(control.value ?? '') ? null : { skuFormat: true }; }}Note multi: true — NG_VALIDATORS is a multi-provider token, and omitting it replaces every other validator on the element.
Where template-driven forms stop scaling: cross-field validation is awkward, dynamic field sets are awkward, the form model is not reusable across components, and tests need manual change-detection choreography because the data flow is asynchronous.
Signal Forms in practice
Section titled “Signal Forms in practice”import { form, FormField, FormRoot, required, email, minLength, submit } from '@angular/forms/signals';
@Component({ imports: [FormField, FormRoot], template: ` <form [formRoot]="registrationForm"> <label for="email">Email</label> <input id="email" type="email" [formField]="registrationForm.email" />
@if (registrationForm.email().touched() && registrationForm.email().invalid()) { <ul class="error"> @for (error of registrationForm.email().errors(); track error) { <li>{{ error.message }}</li> } </ul> }
<button type="submit" [disabled]="registrationForm().submitting()">Create account</button> </form> `,})export class Registration { readonly registrationModel = signal({ email: '', password: '' });
readonly registrationForm = form( this.registrationModel, (path) => { required(path.email, { message: 'Email is required' }); email(path.email, { message: 'Enter a valid email address' }); minLength(path.password, 12, { message: 'Use at least 12 characters' }); }, { submission: { action: async (field) => { const result = await this.api.register(field().value()); if (result.ok) return; return { kind: 'serverError', message: 'Could not create the account' }; }, }, }, );}Field state
Section titled “Field state”Calling a field returns its FieldState:
| Category | Signal | Meaning |
|---|---|---|
| Validation | valid() |
Passes all rules, nothing pending |
invalid() |
Has errors | |
errors() |
Array of error objects | |
pending() |
Async validation running | |
| Interaction | touched() |
Focused then blurred |
dirty() |
Modified by the user, even back to the initial value | |
| Availability | disabled() |
Excluded from parent state |
hidden() |
Should be hidden — you still control visibility with @if |
|
readonly() |
Excluded from parent state |
value() is a WritableSignal, so a field is readable and writable directly.
Two details worth internalising: all validators run on every change — validation does not short-circuit, so a field with both required() and email() can report both errors at once and your template should render errors() as a list rather than assuming one. And dirty() means “the user changed it,” not “it differs from the initial value” — editing a field and typing the original value back leaves it dirty.
The model must be plain data
Section titled “The model must be plain data”Signal Forms walks the model to build the field tree, and the structural layer must be plain objects and arrays. TypeScript will happily accept otherwise, and Signal Forms does not validate the shape at runtime, so the failures are silent and strange:
- Class instances lose their prototype on the first write, because parent objects are shallow-copied on update. Methods, getters and
instanceofstop working afterwards. - Frozen or non-extensible objects inside arrays throw, because Signal Forms assigns a tracking symbol to preserve item identity across reorders.
MapandSetproduce empty field trees, because children are enumerated withObject.keys.
If your domain model uses classes, translate to plain objects at the form boundary and back on submit. Initialise every field you want in the tree — a field absent from the initial model is not in the field tree.
Submission
Section titled “Submission”submit() runs a defined sequence, and knowing it saves a lot of guessing:
- Marks interactive fields as touched, so “show errors only after touch” reveals them. Hidden, disabled and readonly fields are skipped.
- Checks validation. If anything failed, the action does not run.
- Runs the
actionwith the form’s current value, withsubmitting()true throughout. - Routes any errors the action returned to their target fields; returning nothing means success.
It resolves to Promise<boolean> — true on a clean run, false on validation failure or returned errors.
The FormRoot directive on a <form> element does three things automatically: sets novalidate (so the browser’s own validation UI stays out of the way), prevents the default navigation, and calls submit().
Validation details
Section titled “Validation details”Built-in rules: required, email, min, max, minLength, maxLength, pattern. Custom rules via validate() and validateTree() for cross-field logic, and validateHttp() for server-backed checks, which sets pending() while in flight.
Two behaviours that are easy to get wrong:
required()treats an empty array as present (valid) — useminLength()to require items — and treatsfalseas missing (invalid), which matches<input type="checkbox" required>.- Most built-ins mirror their constraint to the native attribute (
required,min,max,minlength,maxlength) to control input behaviour and improve accessibility, not to trigger native validation.pattern()is the exception and does not set the nativepatternattribute.
Validators can take signals for their limits, so a rule can depend on other state: min(path.participants, () => this.minimumRequired()).
Interoperating with Reactive Forms
Section titled “Interoperating with Reactive Forms”You do not have to migrate everything at once. compatForm from @angular/forms/signals/compat lets an existing FormControl live inside a signal form:
const passwordControl = new FormControl('', { validators: [Validators.required, enterprisePasswordValidator()], nonNullable: true,});
const user = signal({ email: '', password: passwordControl });const f = compatForm(user);
f.password().valid(); // proxied from the reactive controlf.password().errors(); // CompatValidationError when the legacy validator failsThis is the sanctioned path for controls with intricate RxJS logic, third-party integrations, or validators nobody wants to rewrite yet.
Accessibility
Section titled “Accessibility”A form that validates perfectly and is unusable with a screen reader is not finished. The essentials, none of which any of the three systems does for you:
- Every input needs a real label.
<label for="email">or a wrapping<label>. A placeholder is not a label — it disappears on focus and is invisible to some assistive technology. - Associate errors with the field using
aria-describedbypointing at the error element’sid, and mark the fieldaria-invalid="true"when it is invalid. Without that, a screen-reader user hears the field name and nothing about why it was rejected. - Announce errors that appear after submit with a live region (
role="alert"oraria-live="polite"), or the user gets no feedback at all. - Group related controls in a
<fieldset>with a<legend>— required for radio groups to be comprehensible. - Do not rely on colour alone. A red border is invisible information to a lot of people; pair it with text.
- Keep focus manageable. On a failed submit, move focus to the first invalid field. Never trap it.
- Disabled submit buttons are a trade-off. They prevent an invalid submission but are not focusable, so a keyboard user cannot reach them to discover why nothing happens. Consider leaving the button enabled and surfacing errors on submit instead.
Testing
Section titled “Testing”Reactive forms test without rendering. The form model is synchronous and available in the class, so most logic needs no fixture at all:
it('rejects a malformed email', () => { const form = new LoginForm().form; form.controls.email.setValue('not-an-email'); expect(form.controls.email.hasError('email')).toBe(true);});Signal forms are similar — the model is a signal and the field tree is synchronous:
it('requires an email', () => { const model = signal({ email: '', password: '' }); const f = form(model, (path) => required(path.email)); expect(f.email().invalid()).toBe(true);
f.email().value.set('user@example.test'); expect(f.email().valid()).toBe(true);});Template-driven forms need the DOM and the change-detection cycle, because the model-to-view flow is asynchronous:
it('reflects the model in the input', async () => { const fixture = TestBed.createComponent(ContactForm); fixture.componentInstance.model.email = 'user@example.test';
await fixture.whenStable();
const input = fixture.nativeElement.querySelector('input[name="email"]'); expect(input.value).toBe('user@example.test');});await fixture.whenStable() is doing real work there — it waits for the queued control update on the next tick. This asynchrony is the main practical reason reactive and signal forms are easier to test. See the testing guide.
Anti-patterns
Section titled “Anti-patterns”| Anti-pattern | Why it hurts |
|---|---|
Not using nonNullable |
null in every value type; reset() wipes to null |
form.value on submit |
It is a Partial, and omits disabled controls — use getRawValue() |
| Cross-field validator on a child control | control.parent is undefined during construction |
Async validator with updateOn: 'change' |
A network request per keystroke |
track $index in a FormArray |
Inputs shuffle when an item is removed from the middle |
| Errors shown before the field is touched | The form is red before the user has typed anything |
| Class instances in a Signal Forms model | Prototype lost on first write; silent, confusing failures |
| Business logic in a validator | Validators run constantly; they must be cheap and pure |
| Duplicating validation only on the client | The server must validate independently — always |
disabled attribute plus formControlName |
Angular warns; use control.disable() |
| Assuming reactive-form updates refresh the view | They do not schedule change detection |
| Placeholder used as a label | Disappears on focus; poor assistive-technology support |
Security
Section titled “Security”Client-side validation is a user-experience feature, not a security control. Every rule you enforce in the browser must be enforced again on the server, because the client can be bypassed entirely. Treat client validation as fast feedback for honest users and nothing more.
Beyond that:
- Never bind user-supplied form data into
innerHTML. Angular’s interpolation escapes;[innerHTML]sanitises but is still the wrong default. See Angular Security. - Set
autocompletecorrectly —autocomplete="current-password","new-password","one-time-code". Password managers depend on it, andautocomplete="off"on a password field makes people choose worse passwords. - Do not log form values. A debug
console.log(this.form.value)on a payment or password form is a credential in the browser console and, if you ship client-side logging, in a log aggregator. - Do not persist sensitive fields to
localStoragefor a “restore my draft” feature. - File uploads need server-side type and size validation. An
acceptattribute is a file-picker filter, not a check.
Trade-offs
Section titled “Trade-offs”| Decision | Favours | Costs |
|---|---|---|
| Signal Forms | Types inferred from the model, validation in one schema, signal-native | Requires v21+; newest of the three; plain-data model constraint |
| Reactive Forms | Longest track record, dynamic structures, fine control, testable | More setup; observable plumbing; typing needs care |
| Template-Driven | Fastest to write for simple forms | Does not scale; awkward custom validation; harder to test |
updateOn: 'blur' |
Fewer async validations and requests | Feedback arrives later |
updateOn: 'change' |
Immediate feedback | Validation on every keystroke |
| Errors after touch | The form is not red on arrival | Errors are less discoverable before submit |
| Disabling submit while invalid | Prevents invalid submission | Not focusable; keyboard users cannot discover why |
compatForm bridging |
Incremental migration; keeps hard validators | Two systems live in one form |
Senior interview scenarios
Section titled “Senior interview scenarios”“Three form systems. How do you choose?” By where the state should live and how complex the form is. Template-driven for genuinely simple forms where the component property can be the truth. Reactive when the form is complex or dynamic, when you need programmatic control over the structure, or when you need the stability of the longest-established option. Signal Forms for new signal-based applications on v21 or later, where inferring types from the model and gathering validation into one schema are worth the newness. And explicitly: do not migrate a working reactive form without a reason — Angular’s own guidance says reactive forms remain a solid choice.
“Why is form.value.email typed string | null | undefined?”
Two separate causes. null because a FormControl resets to null unless created with nonNullable: true. undefined because form.value excludes disabled controls, so Angular types it as a Partial of the form’s shape. Fix the first with nonNullable or NonNullableFormBuilder, and the second by using getRawValue() where you need the complete value — which is normally on submit.
“Where do you put a password-confirmation validator?”
On the FormGroup that contains both controls, not on the confirmation control. A control-level validator that reaches up via control.parent runs during construction, before the parent is wired, and sees undefined. On the group, both values are available and the error lands on the group — so the template reads it from the group, not from the field, which is the part people forget.
“A Signal Forms model holds class instances and behaves strangely after the first edit. Why?”
Signal Forms shallow-copies parent objects when a field updates, which strips the prototype from a class instance. Methods, getters and instanceof checks stop working from that point on. The structural layer of the model must be plain objects and arrays; TypeScript accepts classes and Signal Forms does not validate the shape at runtime, so the failure is silent. Translate to plain objects at the form boundary and back to domain objects on submit. Map and Set fail differently — they produce empty field trees, because children are enumerated with Object.keys.
“Your form validates everything perfectly. Is the data safe?”
No. Client-side validation is a user-experience feature; anyone can bypass it by editing the running JavaScript or by calling the API directly. Every constraint has to be enforced server-side as well — and the server’s rules are the real ones, with the client’s version existing purely to give honest users fast feedback. The same reasoning applies to a disabled submit button and to an accept attribute on a file input: both are UI, neither is a check.
“A reactive form updates its model but the template shows stale values in a zoneless application. Why?”
Reactive forms’ model updates — setValue, patchValue, FormArray.push — update form state and emit on the form’s observables, but they do not schedule change detection. Under ZoneJS the surrounding async work usually triggered a pass anyway; zoneless removes that accident. Connect the form’s observables to a notification: the AsyncPipe, markForCheck() in a subscription, or toSignal on valueChanges/statusChanges so the template reads a signal.
Related pages
Section titled “Related pages”- Template-Driven Forms
- Signals and Angular Reactivity
- Change Detection and Zoneless Angular
- Angular Security
- Angular Testing: From First Test to Large Suites
- Forms basics