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

Function processAsyncValidators

lib/test/angular/1.5.0/angular.js:26225–26249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26223 }
26224
26225 function processAsyncValidators() {
26226 var validatorPromises = [];
26227 var allValid = true;
26228 forEach(ctrl.$asyncValidators, function(validator, name) {
26229 var promise = validator(modelValue, viewValue);
26230 if (!isPromiseLike(promise)) {
26231 throw ngModelMinErr('nopromise',
26232 "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
26233 }
26234 setValidity(name, undefined);
26235 validatorPromises.push(promise.then(function() {
26236 setValidity(name, true);
26237 }, function(error) {
26238 allValid = false;
26239 setValidity(name, false);
26240 }));
26241 });
26242 if (!validatorPromises.length) {
26243 validationDone(true);
26244 } else {
26245 $q.all(validatorPromises).then(function() {
26246 validationDone(allValid);
26247 }, noop);
26248 }
26249 }
26250
26251 function setValidity(name, isValid) {
26252 if (localValidationRunId === 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