I have successfully implemented checklist-model.js for angular to select from a dynamically generated list of objects. However, I now need to create the functionality to move unchecked checkboxes into a new array (and remove them when checked again). Can anyone provide me with some guidance on how to achieve this?
Here is the HTML code:
<label>
<input type="checkbox"
ng-model="check_all_domains"
ng-click="toggle_select_all()"/> all
</label>
<label ng-repeat="objects in objects_model">
<input type="checkbox"
checklist-model="objects_selected"
checklist-value="objects"
ng-checked="check_all_domains"/>
{{objects.name}}
</label>
And here is the model setup:
$scope.objects_model = [
{id : '1', name: 'name1'},
{id : '2', name: 'name2'},
{id : '3', name: 'name3'},
];
$scope.objects_selected = [];
$scope.check_all_domains = false;
$scope.toggle_select_all = function() {
$scope.objects_selected = [];
};
Here is a screenshot demonstrating how it currently works:
And here is how I envision it working:
UPDATED: See the DEMO for the updated and functional version.