Search code examples
angularjsangularjs-filter

filtering in angular by select and checkbox


want to filter out values both the select box and in checkbox i achieved in select box but can't able to get from checkbox

MY PLUNKER DEMO


Solution

  • Example Here. Use a single object for the checkboxes, and then you can use a comparator function in the filter, like this:

    $scope.checkMake = function(value) {
    
      //Assume no filter is applied so the value will be shown.
      var result = true;
    
      for (var i in $scope.selected) {
          if ($scope.selected[i] === true) {
              //if we get here, we know a filter is applied, so 
              //check to see if the passed value is one of the selected 
              //checkboxes
              result = $scope.selected[value];
              break;
          }
      }
      return result;
    }