I want to implement the functionality of "select All" checkbox should get selected when we select all the sub-items.
Plnkr
Here is the plnkr.
why the "select All" model is not getting set?
Change your select
method to this:
$scope.select = function(){
angular.forEach($scope.friends, function (item) {
if(!item.Selected){ // uncheck 'all' if any item is not selected
$scope.selectedAll = false;
}
});
};
UPDATE
You can remove the select
method entirely, 'check all' is handled in the isSelected
method.