这是我的HTML代码:
<table>
<div ng-repeat="product in products" value="{{product}}">
<div id="order_beacon" style="display: inline-flex; width: 100%;" class="row">
<span class="beacon_quantity">Quantity
<select id="beacon_count" class="beacon_count" ng-model="product.quantity">
<option ng-repeat="option in quantityOptions" value="{{option}}">{{option}}</option>
</select>
</span>
</div>
</div>
</table>
在我的JS中,我从服务器中得到了产品列表,甚至硬编码所有产品,使数量为1。
for (var j = 0; j < $scope.productsAll.length; j++) {
$scope.productsAll[j].quantity = 1;
}
如您所见,我的select标签将ng模型设置为product.quantity。那么,不应该将默认值设置为这个值吗?