title: Dynamic filtering in angularJs using multiple checkboxes
body: <p>I am trying to filter the json data by using multiple check boxes in different categories,So far iam successful in filtering the data but what I need is to filter the categories also please go through the below fiddle  to understand this 
  <a href="http://jsfiddle.net/mounika12/5b4hzhgg/" rel="nofollow noreferrer">jsfiddle link</a>
   basically when I select something in pantsize category,then shirt size and shoe size filters are also filtered according to the combination,here the problem is filtering of checkboxes is happening in top to bottom direction,for example if I select something in shirt size category then only shoe size check boxes are filtered but not the pant size
  Iam using the following service</p>
  
  <pre><code> $scope.$watch(function () {
          return {
              players: $scope.players,
              usePants: $scope.usePants,
              useShirts: $scope.useShirts,
              useShoes: $scope.useShoes
          }
      }, function (value) {
          var selected;
  
          $scope.pantsGroup = uniqueItems($scope.players, 'pants');
          var filterAfterPants = [];        
          selected = false;
          for (var j in $scope.players) {
              var p = $scope.players[j];
              for (var i in $scope.usePants) {
                  if ($scope.usePants[i]) {
                      selected = true;
                      if (i == p.pants) {
                          filterAfterPants.push(p);
                          break;
                      }
                  }
              }        
          }
          if (!selected) {
              filterAfterPants = $scope.players;
          }
  
          $scope.shirtsGroup = uniqueItems(filterAfterPants, 'shirt');
          var filterAfterShirts = [];        
          selected = false;
          for (var j in filterAfterPants) {
              var p = filterAfterPants[j];
              for (var i in $scope.useShirts) {
                  if ($scope.useShirts[i]) {
                      selected = true;
                      if (i == p.shirt) {
                          filterAfterShirts.push(p);
                          break;
                      }
                  }
              }       
          }
          if (!selected) {
              filterAfterShirts = filterAfterPants;
          }
  
          $scope.shoesGroup = uniqueItems(filterAfterShirts, 'shoes');
          var filterAfterShoes = [];        
          selected = false;
          for (var j in filterAfterShirts) {
              var p = filterAfterShirts[j];
              for (var i in $scope.useShoes) {
                  if ($scope.useShoes[i]) {
                      selected = true;
                      if (i == p.shoes) {
                          filterAfterShoes.push(p);
                          break;
                      }
                  }
              }    
          }
          if (!selected) {
              filterAfterShoes = filterAfterShirts;
          }        
  
          $scope.filteredPlayers = filterAfterShoes;        
      }, true);
  </code></pre>