W3cubDocs

/Angular

SchemaFn

A function that receives a SchemaPathTree and applies rules to fields.

API

type SchemaFn<TModel, TPathKind extends PathKind = PathKind.Root> = (
  p: SchemaPathTree<TModel, TPathKind>,
) => void

Description

A function that receives a SchemaPathTree and applies rules to fields.

A SchemaFn can be passed directly to form or to the schema function to create a cached Schema.

const userFormSchema: SchemaFn<User> = (p) => {
  required(p.name);
  disabled(p.email, ({valueOf}) => valueOf(p.name) === '');
};

const f = form(userModel, userFormSchema, {injector});

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/SchemaFn