• Overview
@angular/forms/signals

ValidationError

interface

Common interface for all validation errors.

API

    
      interface ValidationError {  readonly kind: string;  readonly message?: string | undefined;}
    
    

kind

string

Identifies the kind of error.

message

string | undefined

Human readable error message.

ValidationError.WithFieldTree

interface

Validation error with an associated field tree.

This is returned from field state, e.g., catField.errors() would be of a list of errors with field: catField bound to state.

    
      interface WithFieldTree extends ValidationError {  readonly fieldTree: FieldTree<unknown>;  readonly formField?: FormField<unknown> | undefined;  readonly override kind: string;  readonly override message?: string | undefined;}
    
    

ValidationError.WithField

type
@deprecated

Use ValidationError.WithFieldTree instead

ValidationError.WithFormField

interface

Validation error with an associated field tree and specific form field binding.

    
      interface WithFormField extends WithFieldTree {  readonly formField: FormField<unknown>;  readonly override fieldTree: FieldTree<unknown>;  readonly override kind: string;  readonly override message?: string | undefined;}
    
    

ValidationError.WithOptionalFieldTree

interface

Validation error with optional field.

This is generally used in places where the result might have a field. e.g., as a result of a validateTree, or when handling form submission.

    
      interface WithOptionalFieldTree extends ValidationError {  readonly fieldTree?: FieldTree<unknown> | undefined;  readonly override kind: string;  readonly override message?: string | undefined;}
    
    

ValidationError.WithOptionalField

type

ValidationError.WithoutFieldTree

interface

Validation error with no field.

This is used to strongly enforce that fields are not allowed in validation result.

    
      interface WithoutFieldTree extends ValidationError {  readonly fieldTree?: undefined;  readonly formField?: undefined;  readonly override kind: string;  readonly override message?: string | undefined;}
    
    

ValidationError.WithoutField

type
@deprecated

Use ValidationError.WithoutFieldTree instead

Description

Common interface for all validation errors.

This can be returned from validators.

It's also used by the creation functions to create an instance (e.g. requiredError, minError, etc.).

Jump to details