-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(forms): add support for adding async validators via template #5020
Conversation
@Optional() @Inject(NG_VALIDATORS) validators: | ||
@Optional() @Inject(NG_VALIDATORS) private _validators: | ||
/* Array<Validator|Function> */ any[], | ||
@Optional() @Inject(NG_ASYNC_VALIDATORS) private _asyncValidators: | ||
/* Array<Validator|Function> */ any[], | ||
@Optional() @Inject(NG_VALUE_ACCESSOR) valueAccessors: ControlValueAccessor[]) { | ||
super(); | ||
this._parent = parent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you update the ctor signature and drop this line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
LGTM |
Example: @directive({ selector: '[uniq-login-validator]', providers: [provide(NG_ASYNC_VALIDATORS, {useExisting: UniqLoginValidator, multi: true})] }) class UniqLoginValidator implements Validator { validate(c) { return someFunctionReturningPromiseOrObservable(); } }
a6596f9
to
3a4bf3e
Compare
Merging PR #5020 on behalf of @vsavkin to branch presubmit-vsavkin-pr-5020. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Example: