2016-04-29 8 views
0

У меня есть список налогоплательщиков. Он состоит из двух объектов. когда я проверить на флажке taxlist.taxprecent, taxlist.taxtype будет связываться с ng-modelcartoder.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 эти данные

ответ

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){ 
}; 
Смежные вопросы