Skip to content Skip to sidebar Skip to footer

Angular Checklist-model Checkboxes With Reverse Action

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

Solution 1:

I had a similar issue with checklist-model and I've managed to create a workaround

Although its a pretty nasty solution, it works:

$scope.toggle_select_all = function() {
   $timeout(function() {
       $scope.check_all_domains = $scope.check_all_domains ? false : true;
   });

   if (!$scope.check_all_domains) {
      angular.copy($scope.objects_model, $scope.objects_selected);
   } else {
      angular.copy([], $scope.objects_selected);
   }
};

See this plunkr: http://plnkr.co/edit/CiXO1debaDkKPHPYKNfT?p=preview


I'd highly suggest searching for an alternative, cause later on you'll see that it pays off.

For me this worked: http://jsfiddle.net/cjwprostar/M4vGj/6/ - Chris Waguespack

Source: https://groups.google.com/forum/#!topic/angular/KMS5hXn1OCI

Solution 2:

Updated my demo in question so have a look at the final result

<labelng-repeat="objects in objects_model"class="test"><inputtype="checkbox"checklist-model="objects_selected"checklist-value="objects" /><ing-class="{checked : check_all_domains, 
                unchecked : !check_all_domains, 
                fakecheck : check_all_domains}"></i>{{objects.name}}
  </label>

Post a Comment for "Angular Checklist-model Checkboxes With Reverse Action"