docs(aio): document Custom Async validators

docs(aio): Custom Async validators edits

incorporating suggestions from kapunahelewong
This commit is contained in:
Daniel Karp 2017-09-26 10:58:17 -04:00 committed by Alex Rickabaugh
parent fbc9537952
commit c80e02b881
1 changed files with 4 additions and 0 deletions

View File

@ -139,6 +139,10 @@ null if the control value is valid _or_ a validation error object.
The validation error object typically has a property whose name is the validation key, `'forbiddenName'`, The validation error object typically has a property whose name is the validation key, `'forbiddenName'`,
and whose value is an arbitrary dictionary of values that you could insert into an error message, `{name}`. and whose value is an arbitrary dictionary of values that you could insert into an error message, `{name}`.
Custom async validators are similar to sync validators, but they must instead return a Promise or Observable
that later emits null or a validation error object. In the case of an Observable, the Observable must complete,
at which point the form uses the last value emitted for validation.
### Adding to reactive forms ### Adding to reactive forms
In reactive forms, custom validators are fairly simple to add. All you have to do is pass the function directly In reactive forms, custom validators are fairly simple to add. All you have to do is pass the function directly