Spec-Zone.ru › Angular

apply

Применяет предварительно заданную схему к указанному FieldPath.

API

function apply<TValue>(
  path: SchemaPath<TValue>,
  schema: NoInfer<SchemaOrSchemaFn<TValue>>,
): void;
@parampathSchemaPath<TValue>

Путь, к которому нужно применить схему.

@paramschemaNoInfer<SchemaOrSchemaFn<TValue>>

Схема, которую нужно применить к свойству

@returnsvoid

Примечания по использованию

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);
});

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/forms/signals/apply

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API