我想逐个提醒复选框值。我在列表中有5个复选框。我想获得所选复选框的值。
查看
<ul class="ul-list-10">
<li ng-repeat="assetType in assetTypeList">
<input type="checkbox" ng-model="assetType.checked" ng-click="fnChangeAssetType(assetType)" value="{{assetType.Id}}" />
</li>
</ul>
JS
angular.forEach($scope.assetTypeList, function (item) {
//put your code here
});
答案 0 :(得分:1)
顺便说一句,你可以点击
获取价值Angularjs代码:
var app = angular.module('myapp',[]);
app.controller('myctrl',function($scope){
$scope.assetTypeList=[{id:1,checked:false},{id:2,checked:false},{id:3,checked:false},{id:4,checked:false}];
$scope.fnChangeAssetType=function(val){
alert(val.id);
}
});
HTML
<div ng-app="myapp" ng-controller='myctrl'>
<ul class="ul-list-10">
<li ng-repeat="assetType in assetTypeList">
<input type="checkbox" ng-model="assetType.checked" ng-click="fnChangeAssetType(assetType)" value="{{assetType.id}}" />
{{assetType.id}}
</li>
</ul>
</div>
jsFiddle For solution:http://jsfiddle.net/kLrvs4ty/1/