I am having trouble using a ng-repeat
value in a ng-show
directive.
I have tried a number of solutions, "myForm.".{{value}}.".$error.required"
and not having the {{}}
and even the example below without the {{}}
in the ng-show
directive.
It appears that the value being put into the ng-show
is messing up. I want to be able to create multiple fields using a variable from the fields (generated by ng-repeat
) in naming my input and creating the input control condition.
<form name="myForm">
<div ng-repeat="fields in logEntry.StringValues">
{{fields.Title}} <input type="text" name="{{fields.PropertyInfoName}}" ng-model="user" required>
<span class="error" ng-show="myForm.fields.PropertyInfoName.$error.required">
Required!
</span><br>
</div>
Edit: The following code works, but is without the ng-repeat, that I need.
<form name="myForm">
SomeText Here: <input type="text" name="testName" ng-model="user" required>
<span class="error" ng-show="myForm.testName.$error.required">
Required!
</span><br>
</form>