2016-04-29 32 views
0

我得到了複選框列表的稅表。它由兩個對象組成。當我的複選框taxlist.taxprecent檢查,taxlist.taxtype會結合ng-modelcartoder.taxarray如何在選擇複選框時獲取對象?

[$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這個數據

回答

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){ 
}; 
相關問題