()
| 24926 | } |
| 24927 | |
| 24928 | function processAsyncValidators() { |
| 24929 | var validatorPromises = []; |
| 24930 | var allValid = true; |
| 24931 | forEach(ctrl.$asyncValidators, function(validator, name) { |
| 24932 | var promise = validator(modelValue, viewValue); |
| 24933 | if (!isPromiseLike(promise)) { |
| 24934 | throw $ngModelMinErr("$asyncValidators", |
| 24935 | "Expected asynchronous validator to return a promise but got '{0}' instead.", promise); |
| 24936 | } |
| 24937 | setValidity(name, undefined); |
| 24938 | validatorPromises.push(promise.then(function() { |
| 24939 | setValidity(name, true); |
| 24940 | }, function(error) { |
| 24941 | allValid = false; |
| 24942 | setValidity(name, false); |
| 24943 | })); |
| 24944 | }); |
| 24945 | if (!validatorPromises.length) { |
| 24946 | validationDone(true); |
| 24947 | } else { |
| 24948 | $q.all(validatorPromises).then(function() { |
| 24949 | validationDone(allValid); |
| 24950 | }, noop); |
| 24951 | } |
| 24952 | } |
| 24953 | |
| 24954 | function setValidity(name, isValid) { |
| 24955 | if (localValidationRunId === currentValidationRunId) { |
no test coverage detected