()
| 30749 | } |
| 30750 | |
| 30751 | function processAsyncValidators() { |
| 30752 | var validatorPromises = []; |
| 30753 | var allValid = true; |
| 30754 | forEach(that.$asyncValidators, function(validator, name) { |
| 30755 | var promise = validator(modelValue, viewValue); |
| 30756 | if (!isPromiseLike(promise)) { |
| 30757 | throw ngModelMinErr('nopromise', |
| 30758 | 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); |
| 30759 | } |
| 30760 | setValidity(name, undefined); |
| 30761 | validatorPromises.push(promise.then(function() { |
| 30762 | setValidity(name, true); |
| 30763 | }, function() { |
| 30764 | allValid = false; |
| 30765 | setValidity(name, false); |
| 30766 | })); |
| 30767 | }); |
| 30768 | if (!validatorPromises.length) { |
| 30769 | validationDone(true); |
| 30770 | } else { |
| 30771 | that.$$q.all(validatorPromises).then(function() { |
| 30772 | validationDone(allValid); |
| 30773 | }, noop); |
| 30774 | } |
| 30775 | } |
| 30776 | |
| 30777 | function setValidity(name, isValid) { |
| 30778 | if (localValidationRunId === that.$$currentValidationRunId) { |
no test coverage detected