MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / processAsyncValidators

Function processAsyncValidators

lib/test/angular/1.8.0/angular.js:30751–30775  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30749 }
30750
30751 function processAsyncValidators() {
30752 var validatorPromises = [];
30753 var allValid = true;
30754 forEach(that.$asyncValidators, function(validator, name) {
30755 var promise = validator(modelValue, viewValue);
30756 if (!isPromiseLike(promise)) {
30757 throw ngModelMinErr('nopromise',
30758 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
30759 }
30760 setValidity(name, undefined);
30761 validatorPromises.push(promise.then(function() {
30762 setValidity(name, true);
30763 }, function() {
30764 allValid = false;
30765 setValidity(name, false);
30766 }));
30767 });
30768 if (!validatorPromises.length) {
30769 validationDone(true);
30770 } else {
30771 that.$$q.all(validatorPromises).then(function() {
30772 validationDone(allValid);
30773 }, noop);
30774 }
30775 }
30776
30777 function setValidity(name, isValid) {
30778 if (localValidationRunId === that.$$currentValidationRunId) {

Callers 1

angular.jsFile · 0.70

Calls 4

forEachFunction · 0.70
isPromiseLikeFunction · 0.70
setValidityFunction · 0.70
validationDoneFunction · 0.70

Tested by

no test coverage detected