我有以下代码:
<div class="table-responsive" ng-if="form.productDetails != false">
<table class="table table-striped table-condensed table-hover">
<thead>
<tr class="small">
<th class="col-xs-1">Name of Product/th>
<th class="col-xs-1">Price</th>
<th class="col-xs-1">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="productDetails in form.productDetails.item">
<td ng-form="prductForm"><input type="hidden" name="productDetails" required ng-model="form.mainProductDetails.productDetails" ng-value="{{productDetails.name}}"></td>
<td>{{productDetails.name}}</td>
<td>{{productDetails.price}}</td>
<td>
<button type="button" class="btn btn-xs btn-primary" ng-click="editProduct(productDetails)"><i class="glyphicon glyphicon-pencil"></i> Edit</button>
<button type="button" class="btn btn-xs btn-danger" ng-click="removeProduct(productDetails)"><i class="glyphicon glyphicon-trash"></i> Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
现在我想创建所需的表或列,并且只有在表列中存在任何数据时才会验证表。
我添加了需要的隐藏输入字段。根据从ng-repeat传递的数据,应该进行验证。
我见过很多例子但不太确定如何解决这个问题。提前谢谢。