fix(forms): Broken link NG_VALIDATORS replace by an example (#15480)
PR Close #15480
This commit is contained in:
parent
f7328c69b3
commit
35977e3830
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue