title: Angularjs pass an array to custom filter as parameter
body: <p>When defining a custom filter in Angularjs like below I'm passing in the data set I want filtered and an array to serve as the filter values:</p>
  <p><strong>Toggle buttons state passed in an array</strong>
  <a href="https://i.stack.imgur.com/krpeG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/krpeG.png" alt="enter image description here" /></a></p>
  <p><strong>Parameter array value passed into the filter</strong>
  <a href="https://i.stack.imgur.com/9UYYS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9UYYS.png" alt="enter image description here" /></a></p>
  <p>How the filter is called:</p>
  <pre><code>&lt;div class=&quot;row&quot; ng-repeat=&quot;item in data | filterStats:filters&quot;&gt;
  </code></pre>
  <p>The custom filter checks which values in the array should apply by filtering the data set in ng-repeat.</p>
  <pre><code>   .filter('filterStats', function () {
          return function (items, paramArray) {
          var isFilterEmpty = true;
              angular.forEach(paramArray, function (value, key) {
              if (value == 0) {
                  isFilterEmpty = false;
              }
          });
  
          if(!isFilterEmpty) 
          //More logic
     }
  }
  </code></pre>
  <p><strong>Problem:</strong> The problem is that the array parameter does not seems to be able to loop using a forEach inside of the custom filter. The parameter array shows [<code>Array[0]</code>] therefore seems empty.
  Can anyone please provide guidance on this matter? Can one pass an Array as a custom filter parameter? What am I missing?</p>
  <p>Tx.</p>