<div ng-repeat="fod in form.order_details">
...
<td class="control-cell">
<span ng-class="{error: prForm['qty_'+$index].$error.required && showValidationMessages}">
<input type="number" name="{{'qty_' + $index}}" ng-model="fod.qty" ng-change="qtyPerKindCalc($index);" id="{{'qty_' + $index}}" required />
<span ng-show="prForm['qty_'+$index].$error.required && showValidationMessages" class="error-msg">This field required</span>
</span>
</td>
...
</div>
ngRepeat, where i'm have required field. I'm have form object $scope.prForm - where i'm see $error. Problem is in name="{{'qty_' + $index}}". In $scope.prForm i'm have field
{{'qty_' + $index}}: instantiate.c
but i'm need
qty_0: instantiate.c
How I can have good {{'qty_' + $index}} operation in name attribute?
Very easy:
name="qty_{{$index}}"
Here is a plunk to see how it work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With