fix(forms): Broken link NG_VALIDATORS replace by an example (#15480)

PR Close #15480
This commit is contained in:
WilliamKoza 2017-12-01 11:08:46 +01:00 committed by Igor Minar
parent f7328c69b3
commit 35977e3830
1 changed files with 14 additions and 0 deletions

View File

@ -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<Array<Validator|Function>>('NgValidators');