• Overview
@angular/forms/signals

metadata

function
stablesince v22.0

Sets a value for the MetadataKey for this field.

API

function metadata<
  TValue,
  TKey extends MetadataKey<any, any, any>,
  TPathKind extends PathKind = PathKind.Root,
>(
  path: SchemaPath<TValue, 1, TPathKind>,
  key: TKey,
  logic: NoInfer<
    LogicFn<
      TValue,
      TKey extends LimitSelectionKey
        ? LimitKey<TValue>
        : MetadataSetterType<TKey>,
      TPathKind
    >
  >,
): TKey;
@parampathSchemaPath<TValue, 1, TPathKind>

The target path to set the metadata for.

@paramkeyTKey

The metadata key

@paramlogicNoInfer<LogicFn<TValue, TKey extends LimitSelectionKey ? LimitKey<TValue> : MetadataSetterType<TKey>, TPathKind>>

A function that receives the FieldContext and returns a value for the metadata.

@returnsTKey

Description

Sets a value for the MetadataKey for this field.

This value is combined via a reduce operation defined by the particular key, since multiple rules in the schema might set values for it.

Jump to details