从后端获取数组如下:
$scope.arr = [
{
selected:true;
}
{
selected:true;
}
{
selected:true;
}
]
$scope.select = function(){
// 如何在不调用后端接口的情况下,修改ng-repeat中ng-checked的状态实现全选和反选?
}
<ul>
<li ng-repeat="i in arr">
<input type="checkbox" ng-checked="i.selected">
</li>
</ul>
<input type="checkbox" ng-click="select()">
The inverse selection here means that when not all are selected, the selected becomes unselected, and the unselected becomes selected, not cleared! ! !
Empty is a bit more complicated.
http://stackoverflow.com/questions/12648466/how-can-i-get-angular-js-checkboxes-with-select-unselect-all-functionality-and-i