title: Angular Custom Filter on Array.length and Array Iteration
body: <p>I'm trying to write a custom filter which will only show the filtered items in a table.</p>
  
  <h2>Filter</h2>
  
  <pre><code>app.filter('status', function() {
      return function(input, theStatus) {
          var out = [];
  
          for (var i = 0; i &lt; input.length; i++) {
              var gem = input[i];
              if (gem.status === theStatus)
                  out.push(gem);
          }
  
          return out;
      };
  });
  </code></pre>
  
  <p>When I use this in my <code>ng-repeat="gem in gemList | status: 3"</code> only my gems with a <code>gem.status = 3</code> are displayed. This works perfectly, as expected.</p>
  
  <p>But I also want to find out how many gems in my gemList have status = 3. I thought I could <code>{{ gemList.length | status: 3 }}</code> as well but this is not the case. Is there a way to write my filter to address both purposes? Or must I write a unique filter for each case?</p>