I am trying to target the form element within an ng-repeat using a 1:n selector in ng-class. However, I have run into issues with using {{}} + $index in the ng-class expression. The interpolation seems to be parsed correctly but ng-class is not recognizing the selector when it contains {{}} + $index.
Code:
<form name="vm.itemForm" ng-submit="vm.onSave()">
(...)
<tr ng-repeat="item in vm.item.sizes | orderBy:predicate:reverse">
(...)
<div class="dc-input-group">
<input class=""
ng-model="item.stock"
ng-class="{ 'testclass': vm.itemform.{{'stockInput'+$index}}.mySelector }"
name="{{'stockInput'+$index}}" />
</div>
HTML Output:
<input class="form-validation dc-input dc-input--in-input-group dc-input--text-right ng-touched ng-not-empty ng-dirty ng-valid-number ng-valid ng-valid-required"
ng-model="item.stock"
ng-class="{ 'testclass': vm.form.stockInput1.$valid }"
required=""
name="stockInput1"
type="number">