()
| 29678 | } |
| 29679 | |
| 29680 | function processAsyncValidators() { |
| 29681 | var validatorPromises = []; |
| 29682 | var allValid = true; |
| 29683 | forEach(that.$asyncValidators, function(validator, name) { |
| 29684 | var promise = validator(modelValue, viewValue); |
| 29685 | if (!isPromiseLike(promise)) { |
| 29686 | throw ngModelMinErr('nopromise', |
| 29687 | 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); |
| 29688 | } |
| 29689 | setValidity(name, undefined); |
| 29690 | validatorPromises.push(promise.then(function() { |
| 29691 | setValidity(name, true); |
| 29692 | }, function() { |
| 29693 | allValid = false; |
| 29694 | setValidity(name, false); |
| 29695 | })); |
| 29696 | }); |
| 29697 | if (!validatorPromises.length) { |
| 29698 | validationDone(true); |
| 29699 | } else { |
| 29700 | that.$$q.all(validatorPromises).then(function() { |
| 29701 | validationDone(allValid); |
| 29702 | }, noop); |
| 29703 | } |
| 29704 | } |
| 29705 | |
| 29706 | function setValidity(name, isValid) { |
| 29707 | if (localValidationRunId === that.$$currentValidationRunId) { |
no test coverage detected