i have tree of checkboxes . Departments and under each department there are some checkboxes for employees. when user check on department all employees are selected under this department. I add the unique departments keys to an array. My problem is how to remove the unchecked department key from the array.
$scope.leftdept = function (m) {
console.log(m);
for (i = 0; i < m.length; i++) {
if ($scope.depts.indexOf(m[i].Dep_key) === -1) {
$scope.depts.push(m[i].Dep_key);
}
console.log($scope.depts);
}
delete Object[key];in your for loop while checking if they have unchecked department or not.