Перейти к основному содержимому

apply()

function apply<TForm, TField>(fields, behaviors): void;

Defined in: core/behavior/compose-behavior.ts:109

Применить behavior схему к вложенному полю или полям

Поддерживает:

  • Одно поле или массив полей
  • Одну схему или массив схем
  • Все комбинации (поле + схема, поле + схемы, поля + схема, поля + схемы)

Type Parameters

TForm

TForm

TField

TField

Parameters

fields

Одно поле или массив полей

FieldPathNode<TForm, TField, unknown> | ( | FieldPathNode<TForm, TField, unknown> | undefined)[] | undefined

behaviors

Одна схема или массив схем

BehaviorSchemaFn<TField> | BehaviorSchemaFn<TField>[]

Returns

void

Example

// Одна схема к одному полю
apply(path.registrationAddress, addressBehavior);

// Одна схема к нескольким полям
apply([path.registrationAddress, path.residenceAddress], addressBehavior);

// Несколько схем к одному полю
apply(path.properties, [propertyBehavior, arrayBehavior]);

// Несколько схем к нескольким полям
apply(
[path.registrationAddress, path.residenceAddress],
[addressBehavior, validationBehavior]
);