
Angular Signals Form example
A minimal example illustrates the shape of this approach. The model remains a simple interface, and the signal holds the current form values.
interface RegistrationData {
email: string;
password: string;
confirmPassword: string;
acceptedTerms: boolean;
}
The form is then created by passing this model signal into form(), along with a schema that declares validation rules.
const registrationModel = signal({
email: '',
password: '',
confirmPassword: '',
acceptedTerms: false,
});
const registrationForm = form(registrationModel, (schema) => {
required(schema.email, { message: 'Email is required' });
email(schema.email, { message: 'Enter a valid email address' });
required(schema.password, { message: 'Password is required' });
required(schema.confirmPassword, { message: 'Please confirm your password' });
required(schema.acceptedTerms, {
message: 'You must accept the terms to continue',
});
});
What matters here is not the syntax, but the structure. The model signal defines what the form is. The schema defines what constraints apply. Angular takes responsibility for deriving field state and exposing it through signals that the UI can consume directly.

