• Genel Bakış
@angular/forms/signals

ValidationError

interface
kararlıv22.0'den beri

Common interface for all validation errors.

API

    
      interface ValidationError {}
    
    

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 {}
    
    

ValidationError.WithFormField

interface

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

    
      interface WithFormField extends WithFieldTree {}
    
    

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 {}
    
    

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 {}
    
    

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.).

Detaylara atla