title: Dynamic filter within ng-repeat in AngularJS
body: <p>For my AngularJS app I have an ng-repeat in an ng-repeat like so:</p>
  
  <p>Html:</p>
  
  <pre><code>&lt;div ng-app="myApp"&gt;
      &lt;div ng-controller="myController"&gt;
          &lt;h2&gt;working filter&lt;/h2&gt;
          &lt;div ng-repeat="category in categories"&gt;
              &lt;h3&gt;{{category}}&lt;/h3&gt;
              &lt;div ng-repeat="item in items | filter:{price.red: 0} "&gt;{{item.name}}&lt;/div&gt;
      &lt;/div&gt;
  
          &lt;h2&gt;broken filter&lt;/h2&gt;
          &lt;div ng-repeat="category in categories"&gt;
              &lt;h3&gt;{{category}}&lt;/h3&gt;
              &lt;!-- price[category] should be red, blue, yellow, depending on the category in the ng-repeat --&gt;
              &lt;!-- price[category] should be bigger then 0 (or not zero, negative values will not occur) --&gt;
              &lt;div ng-repeat="item in items | filter:{price[category]: 0} "&gt;{{item.name}}&lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>var myApp = angular.module('myApp', []);
  
  myApp.controller('myController', function ($scope) {
  
      $scope.categories = ['red', 'blue', 'yellow'];
      $scope.items = [
          {name: 'one', price:{red: 0, blue: 1, yellow: 3} },
          {name: 'two', price:{red: 2, blue: 0, yellow: 0}},
      ]    
  
  });
  </code></pre>
  
  <p>Please see my jsFiddle <a href="http://jsfiddle.net/hm8qD/" rel="noreferrer">http://jsfiddle.net/hm8qD/</a></p>
  
  <p>So I ran into two problems:</p>
  
  <ol>
  <li>The flter does not accept [] brackets so I cannot make the filter dynamic, based on the category</li>
  <li>The filter needs to return items that have a price[category] greater then zero.</li>
  </ol>
  
  <p>For the greater then zero I could just make a custom filter. However as far as I know filters don't accept parameters so I have no way of getting the category (red, blue or yellow) to it.</p>
  
  <p>Please note this is an simplified version of my actual code and this context might not make the best of sense. I hope I was clear in explaining what I need the filter to do, since I'm new to AngularJS.</p>