Contains all of the state (e.g. value, statuses, etc.) associated with a FieldTree, exposed as
signals.
API
interface FieldState<TValue, TKey extends string | number = string | number> extends ɵFieldState<TValue> {}
dirty
Signal<boolean>A signal indicating whether field value has been changed by user.
disabledReasons
Signal<readonly DisabledReason[]>errors
Signal<ValidationError[]>errorSummary
Signal<ValidationError[]>A signal containing the errors of the field and its descendants.
valid
Signal<boolean>A signal indicating whether the field's value is currently valid.
Note: valid() is not the same as !invalid().
valid()istruewhen there are no validation errors and no pending validators.invalid()istruewhen there are validation errors, regardless of pending validators.
Ex: consider the situation where a field has 3 validators, 2 of which have no errors and 1 of
which is still pending. In this case valid() is false because of the pending validator.
However invalid() is also false because there are no errors.
invalid
Signal<boolean>A signal indicating whether the field's value is currently invalid.
Note: invalid() is not the same as !valid().
invalid()istruewhen there are validation errors, regardless of pending validators.valid()istruewhen there are no validation errors and no pending validators.
Ex: consider the situation where a field has 3 validators, 2 of which have no errors and 1 of
which is still pending. In this case invalid() is false because there are no errors.
However valid() is also false because of the pending validator.
pending
Signal<boolean>Whether there are any validators still pending for this field.
submitting
Signal<boolean>A signal indicating whether the field is currently in the process of being submitted.
keyInParent
Signal<TKey>The property key in the parent field under which this field is stored. If the parent field is array-valued, for example, this is the index of this field in that array.
fieldBindings
Signal<readonly Field<unknown>[]>The Field directives that bind this field to a UI control.
metadata
M | undefinedReads a metadata value from the field.
M | undefinedhasMetadata
booleanChecks whether the given metadata key has been defined for this field.
booleanreset
voiddisabled
Signal<boolean>A signal indicating whether the field is currently disabled.
max
Signal<number | undefined> | undefinedA signal indicating the field's maximum value, if applicable.
Applies to <input> with a numeric or date type attribute and custom controls.
maxLength
Signal<number | undefined> | undefinedA signal indicating the field's maximum string length, if applicable.
Applies to <input>, <textarea>, and custom controls.
min
Signal<number | undefined> | undefinedA signal indicating the field's minimum value, if applicable.
Applies to <input> with a numeric or date type attribute and custom controls.
minLength
Signal<number | undefined> | undefinedA signal indicating the field's minimum string length, if applicable.
Applies to <input>, <textarea>, and custom controls.
name
Signal<string>A signal of a unique name for the field, by default based on the name of its parent field.
readonly
Signal<boolean>A signal indicating whether the field is currently readonly.
required
Signal<boolean> | undefinedA signal indicating whether the field is required.
touched
Signal<boolean>A signal indicating whether the field has been touched by the user.
value
WritableSignal<T>A writable signal containing the value for this field. Updating this signal will update the data model that the field is bound to.
markAsDirty
voidSets the dirty status of the field to true.
voidmarkAsTouched
voidSets the touched status of the field to true.
void