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

Function processAsyncValidators

lib/test/angular/1.7.0/angular.js:29789–29813  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29787 }
29788
29789 function processAsyncValidators() {
29790 var validatorPromises = [];
29791 var allValid = true;
29792 forEach(that.$asyncValidators, function(validator, name) {
29793 var promise = validator(modelValue, viewValue);
29794 if (!isPromiseLike(promise)) {
29795 throw ngModelMinErr('nopromise',
29796 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
29797 }
29798 setValidity(name, undefined);
29799 validatorPromises.push(promise.then(function() {
29800 setValidity(name, true);
29801 }, function() {
29802 allValid = false;
29803 setValidity(name, false);
29804 }));
29805 });
29806 if (!validatorPromises.length) {
29807 validationDone(true);
29808 } else {
29809 that.$$q.all(validatorPromises).then(function() {
29810 validationDone(allValid);
29811 }, noop);
29812 }
29813 }
29814
29815 function setValidity(name, isValid) {
29816 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