【发布时间】:2016-08-24 14:29:12
【问题描述】:
我在勾选 angularjs 复选框时遇到问题。
购物篮[0].Partdelivery 来自带有 1 的 db update() 向数据库发帖
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" class="checkbox" ng-model="basket[0].PartDelivery" ng-true-value="1" ng-false-value="0" ng-change="update()">
{{basket[0].PartDelivery}}
</label>
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" class="checkbox" ng-model="1" ng-true-value="1" ng-false-value="0" ng-change="update()">
</label>
我也在 html 中测试了这个:
<div ng-controller="basketController as bc" ng-init="basket={basket}; deliveryaddress={deliveryaddress}; getcheckboxes(basket[0].PartDelivery)">
<input type="checkbox" id="inlineCheckbox1" class="checkbox" ng-model="partDeliveryCheck.value" ng-true-value="1" ng-false-value="0" ng-change="update()">
在控制器中:
$scope.getcheckboxes = function(PartDelivery){
$scope.partDeliveryCheck={value: PartDelivery};
};
但是复选框没有被选中...
【问题讨论】: