title: Custom comparator for a single property for Angular $filter
body: <p>First, my reason for creating the custom comparator in the first place is because an attribute on the expression that is an array--such as 'tags'--required the expression to have the values in a particular order and wouldn't match otherwise. (So an expression with tags['a', 'b'] would match ['x', 'a', 'b', 'y'] but not ['x', 'b', 'a', 'y'].)</p>
  
  <p>I've been able to get around this because in Angular's $filter service, it allows you to provide a custom comparator. However, I'm only able to filter based on the attributes type, not the key's value.</p>
  
  <p>I want a custom comparator for only one of the attributes in an object. Is there a way to do that without copying and modifying Angular's source code?</p>
  
  <p>Here is an example of my custom comparator: (found in <a href="http://plnkr.co/edit/eFeinQhHTIZrzXBm4srq" rel="nofollow">http://plnkr.co/edit/eFeinQhHTIZrzXBm4srq</a> )</p>
  
  <pre><code>$scope.inclusiveFilter = function(expected, actual){
      if(expected &amp;&amp; actual){
          console.log(expected, actual);
          if(angular.isArray(expected) &amp;&amp; angular.isArray(actual)){
              for(var t in actual){
                  if(expected.indexOf(actual[t]) == -1){
                      return false;
                  }
              }
          }
  
          return true;
      }
    }
  </code></pre>
  
  <p>In my example the filter on the tags works just fine, but it no longer works on $ to match any property, I am only able to compare attributes based on their type, not their name. So an expression like this could never work:</p>
  
  <pre><code>{
      includeThese: ['a', 'b'],
      excludeThese: ['x', 'y']
  }
  </code></pre>