title: How can I access ngRepeat iterator scope from filter filter
body: <p>I'm writing some application that is a bit like e-shop. I have a list of entities and checkboxes to filter them. And I want to make that checkbox-filters be some sort of universal. I plan to write an expression in checkbox's attribute and then eval in within the scope of each entity by using filter filter in ngRepeat. The problem is how to access the scope of an entity from that filtering function. For example:</p>
  
  <p><em>My data (JS):</em></p>
  
  <pre><code>food = [
    {
      category: 'fruits',
      name: 'Apple'
    },
    {
      category: 'vegetables',
      name: 'Potato'
    }
  ]
  </code></pre>
  
  <p><em>My filter checkbox (HTML):</em></p>
  
  <pre><code>&lt;label&gt;
    Fruits:
    &lt;input type="checkbox" data-filter="category == 'fruits'" /&gt;
  &lt;label/&gt;
  </code></pre>
  
  <p><em>My list (HTML):</em></p>
  
  <pre><code>&lt;ul&gt;
    &lt;li ng-repeat="item in food | filter:customFilterFunction"&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><em>My filter function (JS):</em></p>
  
  <pre><code>$scope.customFilterFunction = function(item) {
    // here I want to eval that expression written in checkbox's attribute
    // within the scope of each item in food array.
    // The problem is not how to access that expression,
    // but how to access the scope of item in food array.
  }
  </code></pre>
  
  <p>Of course, I can create new scope from $rootScope each time I apply that filter function, and then pass all item properties to that new scope, and then eval that expression in this scope. But I think it would consume a lot of memory because of creating a lot of new scopes each time user changes the filters.</p>
  
  <p>Do you know a better solution?</p>