• Overview
@angular/forms/signals

createManagedMetadataKey

function

API

function createManagedMetadataKey<TRead, TWrite>(  create: (s: Signal<TWrite | undefined>) => TRead,): MetadataKey<TRead, TWrite, TWrite | undefined>;function createManagedMetadataKey<TRead, TWrite, TAcc>(  create: (s: Signal<TAcc>) => TRead,  reducer: MetadataReducer<TAcc, TWrite>,): MetadataKey<TRead, TWrite, TAcc>;
function createManagedMetadataKey<TRead, TWrite>(create: (s: Signal<TWrite | undefined>) => TRead): MetadataKey<TRead, TWrite, TWrite | undefined>;

Creates a metadata key that exposes a managed value based on the accumulated result of the values written to the key. The accumulated value takes the last value set on a given field tree node, overriding any previously set values.

@paramcreate(s: Signal<TWrite | undefined>) => TRead

A function that receives a signal of the accumulated value and returns the managed value based on it. This function runs during the construction of the FieldTree node, and runs in the injection context of that node.

@returnsMetadataKey<TRead, TWrite, TWrite | undefined>
function createManagedMetadataKey<TRead, TWrite, TAcc>(create: (s: Signal<TAcc>) => TRead, reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<TRead, TWrite, TAcc>;

Creates a metadata key that exposes a managed value based on the accumulated result of the values written to the key.

@paramcreate(s: Signal<TAcc>) => TRead

A function that receives a signal of the accumulated value and returns the managed value based on it. This function runs during the construction of the FieldTree node, and runs in the injection context of that node.

@paramreducerMetadataReducer<TAcc, TWrite>

The reducer used to combine individual value written to the key, this will determine the accumulated value that the create function receives.

@returnsMetadataKey<TRead, TWrite, TAcc>
Jump to details