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

Function processAsyncValidators

lib/test/angular/1.6.7/angular.js:29170–29194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29168 }
29169
29170 function processAsyncValidators() {
29171 var validatorPromises = [];
29172 var allValid = true;
29173 forEach(that.$asyncValidators, function(validator, name) {
29174 var promise = validator(modelValue, viewValue);
29175 if (!isPromiseLike(promise)) {
29176 throw ngModelMinErr('nopromise',
29177 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
29178 }
29179 setValidity(name, undefined);
29180 validatorPromises.push(promise.then(function() {
29181 setValidity(name, true);
29182 }, function() {
29183 allValid = false;
29184 setValidity(name, false);
29185 }));
29186 });
29187 if (!validatorPromises.length) {
29188 validationDone(true);
29189 } else {
29190 that.$$q.all(validatorPromises).then(function() {
29191 validationDone(allValid);
29192 }, noop);
29193 }
29194 }
29195
29196 function setValidity(name, isValid) {
29197 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