• Overview
@angular/forms/signals

apply

function

Applies a predefined schema to a given FieldPath.

API

function apply<TValue>(
  path: FieldPath<TValue>,
  schema: NoInfer<SchemaOrSchemaFn<TValue>>,
): void;

apply

void

Applies a predefined schema to a given FieldPath.

@parampathFieldPath<TValue>

The target path to apply the schema to.

@paramschemaNoInfer<SchemaOrSchemaFn<TValue>>

The schema to apply to the property

@returnsvoid

Usage Notes

const nameSchema = schema<{first: string, last: string}>((name) => {
  required(name.first);
  required(name.last);
});
const profileForm = form(signal({name: {first: '', last: ''}, age: 0}), (profile) => {
  apply(profile.name, nameSchema);
});
Jump to details