()
| 25767 | } |
| 25768 | |
| 25769 | function processAsyncValidators() { |
| 25770 | var validatorPromises = []; |
| 25771 | var allValid = true; |
| 25772 | forEach(ctrl.$asyncValidators, function(validator, name) { |
| 25773 | var promise = validator(modelValue, viewValue); |
| 25774 | if (!isPromiseLike(promise)) { |
| 25775 | throw ngModelMinErr('nopromise', |
| 25776 | "Expected asynchronous validator to return a promise but got '{0}' instead.", promise); |
| 25777 | } |
| 25778 | setValidity(name, undefined); |
| 25779 | validatorPromises.push(promise.then(function() { |
| 25780 | setValidity(name, true); |
| 25781 | }, function(error) { |
| 25782 | allValid = false; |
| 25783 | setValidity(name, false); |
| 25784 | })); |
| 25785 | }); |
| 25786 | if (!validatorPromises.length) { |
| 25787 | validationDone(true); |
| 25788 | } else { |
| 25789 | $q.all(validatorPromises).then(function() { |
| 25790 | validationDone(allValid); |
| 25791 | }, noop); |
| 25792 | } |
| 25793 | } |
| 25794 | |
| 25795 | function setValidity(name, isValid) { |
| 25796 | if (localValidationRunId === currentValidationRunId) { |
no test coverage detected