Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validations of the input
Message
 
 
À
07/09/2017 13:38:53
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01653867
Message ID:
01654101
Vues:
43
>>>Looks like this might be known behaviour. See: https://stackoverflow.com/questions/31736496/why-does-adding-additional-angularjs-validation-directives-cause-asyncvalidator
>>>and https://github.com/angular/angular.js/issues/14691
>>>
>>>As suggested earlier there may be some condition that you can check in your directive to determine whether the asyncValidator actually needs to run. If it does not then you could just short-circuit the http call
>>
>>Do you know what condition that may be? In the meantime I also asked on StackOverflow (I didn't see your message until now)
>>
>>https://stackoverflow.com/questions/46101820/do-asyncvalidators-fire-all-the-time
>
>Just guessing (since I don't know the situation) but e.g. if the control value is empty or not dirty ?
>
>Actually I'm trying to forget all I know about directives and scopes since moving to Angular2 :-}

This doesn't seem to work
 if (!viewValue || element[0].$pristine) {
                        return services.Q.when(true);
                    }
                    
                    $log.debug("Firing server-side validations...");
e.g. I'm trying to only fire validators if I changed the element, but the $pristine shows undefined.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform