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