diff --git a/packages/forms/src/validators.ts b/packages/forms/src/validators.ts index 3daab238b4..cc87a22f86 100644 --- a/packages/forms/src/validators.ts +++ b/packages/forms/src/validators.ts @@ -24,6 +24,20 @@ function isEmptyInputValue(value: any): boolean { * * Provide this using `multi: true` to add validators. * + * ### Example + * + * ```typescript + * @Directive({ + * selector: '[custom-validator]', + * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}] + * }) + * class CustomValidatorDirective implements Validator { + * validate(control: AbstractControl): ValidationErrors | null { + * return {"custom": true}; + * } + * } + * ``` + * * @stable */ export const NG_VALIDATORS = new InjectionToken>('NgValidators');