()
| 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) { |
no test coverage detected