2 回答

TA贡献1801条经验 获得超16个赞
您的select标签需要一个名称。AngularJS中的验证状态要求form元素具有名称:
<td ng-class="{ 'has-error': myForm['input_select_' + {{$index}}].$invalid && (myForm['input_select_' + {{$index}}].$touched || myForm.$submitted) }">
<select class="form-control"
name="input_select_{{$index}}"
ng-required="true"
ng-options="env for env in types"
ng-model="data.type">
<option value="">Select</option>
</select>
</td>

TA贡献1862条经验 获得超6个赞
您尝试使用$ index函数。
<tr ng-repeat="data in myData track by $index">
<td>
<select class="form-control" style="color:{{highlight[$index]}};" ng-required="true" ng-options="env for env in types" ng-model="data.type" ng-change="colorchange($index)">
<option value="">Select</option>
</select>
</td>
</tr>
添加回答
举报