Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

vsavkin
Copy link
Contributor

@vsavkin vsavkin commented Oct 30, 2015

Example:

@Directive({
  selector: '[uniq-login-validator]',
  providers: [provide(NG_ASYNC_VALIDATORS, {useExisting: UniqLoginValidator, multi: true})]
})
class UniqLoginValidator implements Validator {
  validate(c) { return someFunctionReturningPromiseOrObservable(); }
}

@vsavkin vsavkin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 30, 2015
@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;
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@vicb
Copy link
Contributor

vicb commented Oct 30, 2015

LGTM

Example:

@directive({
  selector: '[uniq-login-validator]',
  providers: [provide(NG_ASYNC_VALIDATORS, {useExisting: UniqLoginValidator, multi: true})]
})
class UniqLoginValidator implements Validator {
  validate(c) { return someFunctionReturningPromiseOrObservable(); }
}
@vsavkin vsavkin added the action: merge The PR is ready for merge by the caretaker label Nov 2, 2015
@mary-poppins
Copy link

Merging PR #5020 on behalf of @vsavkin to branch presubmit-vsavkin-pr-5020.

@mary-poppins mary-poppins removed the action: merge The PR is ready for merge by the caretaker label Nov 2, 2015
@vsavkin vsavkin closed this in 1c322f1 Nov 2, 2015
@danturu danturu mentioned this pull request Nov 20, 2015
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants