• Overview
@angular/forms/signals

applyWhen

function

Conditionally applies a predefined schema to a given FieldPath.

API

function applyWhen<TValue>(
  path: FieldPath<TValue>,
  logic: LogicFn<TValue, boolean>,
  schema: NoInfer<SchemaOrSchemaFn<TValue>>,
): void;

applyWhen

void

Conditionally applies a predefined schema to a given FieldPath.

@parampathFieldPath<TValue>

The target path to apply the schema to.

@paramlogicLogicFn<TValue, boolean>

A LogicFn<T, boolean> that returns true when the schema should be applied.

@paramschemaNoInfer<SchemaOrSchemaFn<TValue>>

The schema to apply to the field when the logic function returns true.

@returnsvoid
Jump to details