()
| 28275 | } |
| 28276 | |
| 28277 | function processAsyncValidators() { |
| 28278 | var validatorPromises = []; |
| 28279 | var allValid = true; |
| 28280 | forEach(ctrl.$asyncValidators, function(validator, name) { |
| 28281 | var promise = validator(modelValue, viewValue); |
| 28282 | if (!isPromiseLike(promise)) { |
| 28283 | throw ngModelMinErr('nopromise', |
| 28284 | 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); |
| 28285 | } |
| 28286 | setValidity(name, undefined); |
| 28287 | validatorPromises.push(promise.then(function() { |
| 28288 | setValidity(name, true); |
| 28289 | }, function() { |
| 28290 | allValid = false; |
| 28291 | setValidity(name, false); |
| 28292 | })); |
| 28293 | }); |
| 28294 | if (!validatorPromises.length) { |
| 28295 | validationDone(true); |
| 28296 | } else { |
| 28297 | $q.all(validatorPromises).then(function() { |
| 28298 | validationDone(allValid); |
| 28299 | }, noop); |
| 28300 | } |
| 28301 | } |
| 28302 | |
| 28303 | function setValidity(name, isValid) { |
| 28304 | if (localValidationRunId === currentValidationRunId) { |
no test coverage detected