()
| 30684 | } |
| 30685 | |
| 30686 | function processAsyncValidators() { |
| 30687 | var validatorPromises = []; |
| 30688 | var allValid = true; |
| 30689 | forEach(that.$asyncValidators, function(validator, name) { |
| 30690 | var promise = validator(modelValue, viewValue); |
| 30691 | if (!isPromiseLike(promise)) { |
| 30692 | throw ngModelMinErr('nopromise', |
| 30693 | 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); |
| 30694 | } |
| 30695 | setValidity(name, undefined); |
| 30696 | validatorPromises.push(promise.then(function() { |
| 30697 | setValidity(name, true); |
| 30698 | }, function() { |
| 30699 | allValid = false; |
| 30700 | setValidity(name, false); |
| 30701 | })); |
| 30702 | }); |
| 30703 | if (!validatorPromises.length) { |
| 30704 | validationDone(true); |
| 30705 | } else { |
| 30706 | that.$$q.all(validatorPromises).then(function() { |
| 30707 | validationDone(allValid); |
| 30708 | }, noop); |
| 30709 | } |
| 30710 | } |
| 30711 | |
| 30712 | function setValidity(name, isValid) { |
| 30713 | if (localValidationRunId === that.$$currentValidationRunId) { |
no test coverage detected