title: AngularJs filter with array of values
body: <p>is it possible to filter $scope.items by comparing them with an array? And put the result in $scope.itemsfiltered?
  The following url explains it all (scroll downwards): <a href="http://angular-tips.com/blog/2014/08/tip-accessing-filtered-array-outside-ng-repeat/" rel="nofollow">http://angular-tips.com/blog/2014/08/tip-accessing-filtered-array-outside-ng-repeat/</a></p>
  
  <p>I've tried a function that compared all items with some array values and it works.
  But the result only shows up when I assign the result to $scope.items, not when I assign it to $scope.itemsfiltered.</p>
  
  <p>So A) something like above (see code below)</p>
  
  <p>Or B) Something more simple, a regex or something to compare with... so a model "filtereditem" is not necessary, and just do: $scope.filterByRegexOrSomethingElse = /compare1|compare2/;</p>
  
  <pre><code>&lt;div class="item" ng-repeat="item in (itemsfiltered = (items | filter:filterByArr))"&gt;
      {{ title }}
  &lt;/div&gt;
  
  $scope.filterByArray = function () {
      var arr = ['foo', 'bar'];
  
      // do some magic here
      var filtered = [];
  
      for (var i = 0; i &lt; items.length; i++) {
          //  resetScope($scope);
          if (_.contains(arr, items[i].categorie)) {
              filtered.push( items[i] );
          }
      }
  
      $scope.itemsfiltered = filtered;
  };
  </code></pre>