>>>My new question on that topic:
>>>
>>>
https://stackoverflow.com/questions/46122489/preventing-extra-calls-of-asyncvalidators>>
>>The jist of most of the links seems to be that you cannot rely on failed regular validators to prevent the async validators firing *on page load*.
>>
>>You probably need to add more logic to ngModel.$asyncValidators.smCodeUnique to ensure that situations that don't require the $http call return services.Q.when(true);
>
>Do you know how can I check inside the validator is the field was changed or not? Because I only want to fire the validators after I changed the field, not in the load. I think I tried using element[0].$dirty and that didn't work. I may try this again inside the validator's call.
>
>UPDATE. I think I was able to solve it although I don't know if this is a bullet proof solution or even a good one. Before declaring my directive I added this
>
> var services,
> $log, originalValue;
>
>And inside the code for the directive I added:
>
>
>ngModel.$asyncValidators.smCodeUnique = function (modelValue, viewValue) {
> if (!originalValue) {
> originalValue = modelValue;
> }
> if (!viewValue || _.isEmpty(modelValue.trim()) || modelValue==originalValue ) {
> return services.Q.when(true);
> }
>
>and then I was watching that it only executed when I changed my value manually (this is what I wanted).
Don't think you can stop the validation running on page load.. Above looks OK to me