Skip to the page

Forms, routing and HTTP · mid

Signal forms

Signal forms (stable in v22) build a form from a signal model and a schema of validation rules.

The notes

What you must know

  • You own the data: model = signal<Signup>({ email: "", password: "" }).
  • Create the form from it: signupForm = form(this.model, (p) => { required(p.email); email(p.email); minLength(p.password, 8); }).
  • In the template, bind a field with <input [formField]="signupForm.email" />, with the FormField directive imported.
  • Each field is callable and exposes signals for value, errors and state (touched, dirty, valid).
  • Signal forms became stable in v22 (facts.md). Reactive forms still exist and appear in many apps.
  • A signal form works with computed and @if naturally, with no valueChanges subscription.
  • In an interview, say when you would still choose reactive forms: an existing app, or a library that needs ControlValueAccessor.

The red pen

Common traps: mistake → fix

  • Mistake: Signal forms replace reactive forms everywhere now

    Fix: both exist; old code keeps reactive forms.

  • Mistake: Signal forms need RxJS

    Fix: state is in signals.

Easy to hard

Questions interviewers ask, easy to hard

  1. What is a signal form and how is it created?
  2. How do you add a rule such as minimum length?
  3. Reactive forms or signal forms for a new screen in v22?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview