Question

I came across the angular checklist model ,the angularjs directive for list of checkboxes here http://vitalets.github.io/checklist-model/ . This works fine, but now i want to add into the model only those which are unchecked from the list.means i want the ids of those which are not checked . previously all the values in the list would be checked and if i unchecked a value that would be added in the model.

I am not getting how am i going to do that .please help.

Was it helpful?

Solution

You can still use checklist-model as it is. But you'll need to do some coding in the controller, like

$scope.$watch("checklistModel", function() {
    $scope.uncheckedOnes = diff($scope.allPossibleValues, $scope.checklistModel);
});

where diff(a,b) calculates the difference between array a and array b.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top