• Overview
@angular/forms/signals/compat

compatForm

function

API

function compatForm<TModel>(model: WritableSignal<TModel>): FieldTree<TModel>;
function compatForm<TModel>(
  model: WritableSignal<TModel>,
  schemaOrOptions: any,
): FieldTree<TModel>;
function compatForm<TModel>(
  model: WritableSignal<TModel>,
  schema: SchemaOrSchemaFn<TModel>,
  options: CompatFormOptions,
): FieldTree<TModel>;
function compatForm<TModel>(model: WritableSignal<TModel>): FieldTree<TModel>;

Creates a compatibility form wrapped around the given model data.

compatForm is a version of the form function that is designed for backwards compatibility with Reactive forms by accepting Reactive controls as a part of the data.

@parammodelWritableSignal<TModel>

A writable signal that contains the model data for the form. The resulting field structure will match the shape of the model and any changes to the form data will be written to the model.

@returnsFieldTree<TModel>
function compatForm<TModel>(model: WritableSignal<TModel>, schemaOrOptions: any): FieldTree<TModel>;

Creates a compatibility form wrapped around the given model data.

compatForm is a version of the form function that is designed for backwards compatibility with Reactive forms by accepting Reactive controls as a part of the data.

@parammodelWritableSignal<TModel>

A writable signal that contains the model data for the form. The resulting field structure will match the shape of the model and any changes to the form data will be written to the model.

@paramschemaOrOptionsany

The second argument can be either

  1. A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.). When passing a schema, the form options can be passed as a third argument if needed.
  2. The form options (excluding adapter, since it's provided).
@returnsFieldTree<TModel>
function compatForm<TModel>(model: WritableSignal<TModel>, schema: SchemaOrSchemaFn<TModel>, options: CompatFormOptions): FieldTree<TModel>;

Creates a compatibility form wrapped around the given model data.

compatForm is a version of the form function that is designed for backwards compatibility with Reactive forms by accepting Reactive controls as a part of the data.

@parammodelWritableSignal<TModel>

A writable signal that contains the model data for the form. The resulting field structure will match the shape of the model and any changes to the form data will be written to the model.

@paramschemaSchemaOrSchemaFn<TModel>
@paramoptionsCompatFormOptions

The form options (excluding adapter, since it's provided).

@returnsFieldTree<TModel>
Jump to details