NG_VALIDATORS

const

npm Package @angular/forms
Module import { NG_VALIDATORS } from '@angular/forms';
Source forms/src/validators.ts

const NG_VALIDATORS: any;

Description

Providers for validators to be used for FormControls in a form.

Provide this using multi: true to add validators.

Example

@Directive({
  selector: '[custom-validator]',
  providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
})
class CustomValidatorDirective implements Validator {
  validate(control: AbstractControl): ValidationErrors | null {
    return {"custom": true};
  }
}

© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/forms/NG_VALIDATORS