Angular Fast Froms
  • Angular Fast Forms
  • Introduction
    • Concepts
    • Getting started
  • Components
    • Form Control
    • Form Group
  • Validation
    • Sync Validator
    • Async Validator
  • Advanced
    • Injection
    • NGXS Support
    • JSON
Powered by GitBook
On this page
Edit on GitHub
  1. Validation

Async Validator

Creation

A custom async validator can be created with a validator factory seen in the following example.

@Validator({
  id: 'custom-async-required',
  type: 'async'
})
@Injectable()
export class AsyncRequiredValidator implements BaseAsyncValidator {

  createValidator(args: string[]): AsyncValidatorFn {
    return control => {
      return of({
        required: true
      })
    };
  }
}
PreviousSync ValidatorNextAdvanced

Last updated 2 years ago