Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validations of the input
Message
De
02/09/2017 04:34:42
 
 
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01653867
Message ID:
01653943
Vues:
51
This message has been marked as a message which has helped to the initial question of the thread.
>>Why return an error - I'd just return true/false.
>>
>>ng-change should be ok but probably a good idea to add a debounce to the model options. Ideally something like:
ng-model-options="{ updateOn: 'default blur', debounce: {'default': 1000, 'blur': 0} }"
This would perform the check after 1sec. of inactivity, or immediately when the focus is moved.
>
>I'd like to return the message explaining where this barcode is already used (e.g. which item). Here is how I'd like the interface to look (see attached).
>
>So, as I understand it will involve setting the error (validation). This is the part I'm not 100% sure how to implement although I did a bit of research.
>
>https://stackoverflow.com/questions/16168355/angularjs-server-side-validation-and-client-side-forms
>
>There was a link in that discussion I planned to follow up but was very busy with other work. May be you have examples of how to do that part.
>
>Thanks.

So have the server return a string describing the problem. I don't think you should (or need) treat a problem as an error.

Two examples here (using directives) that might be worth looking at as an approach to client side handling:
https://stackoverflow.com/questions/12864887/angularjs-integrating-with-server-side-validation
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform