<label ng-repeat="us in user.group_member">
<input type="checkbox" ng-model="not" vlaue="{{us.uid}}" class="groupUser" name="{{us.user_name}}" ng-click="so($event,us.uid,us)" ng-checked="isSelecteds(us.uid)" >{{us.user_name}}
</label>
$scope.isSelected = function(id){
return
$scope.checkedr.indexOf(id)!=-1;
};
$scope.selecteds=[];
$scope.so=function($event,id,o){
var checkbox = $event.target;
var action = (checkbox.checked?'add':'remove');
$scope.updateSelected(action,id,checkbox.name);
}
$scope.updateSelected = function(action,id,name){
if(action == 'add' && $scope.selecteds.indexOf(id) == -1){
$scope.selecteds.push(id);
}else{
// 删除时进行返回元素和指定元素不相等的元素
$scope.selecteds=$scope.selecteds.filter(function(ele){
return ele != id;
})
}
if(action == 'remove' && $scope.selecteds.indexOf(id)!=-1){
var idx = $scope.selecteds.indexOf(id);
$scope.selecteds.splice(idx,1);
}
}