I'm working with checklist-model.js for angular to select from dynamically generated list of objects. It's working fine, but now I need to make it work in reverse so when I uncheck any of checkbox - place it to new array (and when checked back - remove from array). Can any of You give me some ideas or tell me next steps how to deal with it?
html:
<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>
model:
$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 screenshot how it's working right now:
and here is how I want it to work:
UPDATED: WORKING AS IT SHOULD DEMO
Updated my demo in question so have a look at the final result