• Overview
@angular/forms/signals

API

function metadata<TValue, TData, TPathKind extends PathKind = PathKind.Root>(
  path: FieldPath<TValue, TPathKind>,
  factory: (ctx: FieldContext<TValue, TPathKind>) => TData,
): MetadataKey<TData>;
function metadata<TValue, TData, TPathKind extends PathKind = PathKind.Root>(
  path: FieldPath<TValue, TPathKind>,
  key: MetadataKey<TData>,
  factory: (ctx: FieldContext<TValue, TPathKind>) => TData,
): MetadataKey<TData>;
function metadata<TValue, TData, TPathKind = PathKind.Root>(path: FieldPath<TValue, TPathKind>, factory: (ctx: FieldContext<TValue, TPathKind>) => TData): MetadataKey<TData>;

Creates a new MetadataKey and defines the value of the new metadata key for the given field.

@parampathFieldPath<TValue, TPathKind>

The path to define the metadata for.

@paramfactory(ctx: FieldContext<TValue, TPathKind>) => TData

A factory function that creates the value for the metadata. This function is not reactive. It is run once when the field is created.

@returnsMetadataKey<TData>
function metadata<TValue, TData, TPathKind = PathKind.Root>(path: FieldPath<TValue, TPathKind>, key: MetadataKey<TData>, factory: (ctx: FieldContext<TValue, TPathKind>) => TData): MetadataKey<TData>;

Defines the value of a MetadataKey for a given field.

@parampathFieldPath<TValue, TPathKind>

The path to define the metadata for.

@paramkeyMetadataKey<TData>

The metadata key to define.

@paramfactory(ctx: FieldContext<TValue, TPathKind>) => TData

A factory function that creates the value for the metadata. This function is not reactive. It is run once when the field is created.

@returnsMetadataKey<TData>
Jump to details