Im currently having an issue where I want to create multiple form inputs with validation. The form elements I want to create will be up to 100 duplicated fields. To do this I have used ng-repeat as can be seen in this small example below. As you may notice I have a dynamic model and name for my input. Everything works fine with the one exception of validation.
When I inspect the element in the html the dynamic name has got applied as expected and the first name input is called test0. As you may know form validation in angular is done using the form name and input name. As my input is dynamically named it seems to be causing issues as you can see by my error output it doesnt seem to log the error correctly, however, if I was to hardcode the name as test0 instead of test{{i}} (which in the html inspection is test0) everything would work. This is an issue as validation on the duplicated inputs is not doable this way and the only way I can think of resolving this is outputting 100 html input elements manually with the only difference being the name of each input. This is not Ideal and I was wondering if anyone knows a way around this issue or if it is a known bug with Angular? Quite possibly I could just be doing something stupid.
<ng-form name="testform">
<div ng-repeat="i in [0,1,2]">
ERROR {{testform.test0.$error}}
<label>
TEST<br />
<input name="test{{i}}" ng-model="$parent.test[i]" type="text" required />
</label>
</div>
Any help with this matter would be greatly appreciated as I have spent a considerable amount of time trying to resolve this issue.
Thanks.