mardi 24 février 2015

Validation of dynamic form using ng-repeat on AngularJS

I want to validate a group of inputs on my form. I don't need individual names, so I tried to use form.name.$valid to check all.


I pushed a number to a array to increment the number of inputs. The problem is when I remove an input the validity of the inputs become wrong.


Here is a fiddle showing this issue.


http://ift.tt/1JHP3fX


To reproduce the problem, fill the first input. Inputs valid, form valid. Add an input and fill it too. Both valid again. Remove the last input, inputs invalid, form valid.


How can I validate using this type of dynamic form? I will need to use ng-form with individual messages even I want just one error message for all inputs?


Aucun commentaire:

Enregistrer un commentaire