选择复选框时如何获取对象?

时间:2016-04-29 05:51:30

标签: html angularjs

我从税表中获得了复选框列表。 它由两个目标组成。当我选中taxlist.taxprecent复选框时,taxlist.taxtype将绑定到ng-model cartoder.tax,如array

[$promise: Promise, $resolved: false]
0:Resource
__v:0\
_id:"5721d57d5b6691d0107f53c3"
createdAt:"2016-04-28T11:33:02.022Z"
isDeleted:false
modifiedAt:"2016-04-28T11:33:02.023Z"
taxpercent:15
taxtype:"vat"
__proto__:Object
1:Resource
__v:0
_id:"5721ed298ea69da01328cbbc"
createdAt:"2016-04-28T10:59:53.673Z"
isDeleted:false
modifiedAt:"2016-04-28T10:59:53.673Z"
taxpercent:10
taxtype:"service"
__proto__:Object
$promise:Promise
$resolved:true
length:2
__proto__:Array[0]

Html代码

 <span ng-repeat="item in taxlist">
   <label>
     <input type="checkbox" ng-model="cartorder.tax" ng-checked="{{item}}">{{item.taxtype}}
   </label>

我甚至不知道如何开始这个。请帮助bind这个数据

1 个答案:

答案 0 :(得分:0)

您可以添加ng-change

<label><input type="checkbox" ng-model="cartorder.tax" ng-checked="{{item}}" ng-change="onChange(cartorder);">{{item.taxtype}}</label>

JS

$scope.onChange = function(cartorder){
};