title: Using Filters With Directives in AngularJS
body: <p>I'm attempting to use filters within an AngularJS directive but not sure exactly how to do so.  From some info on the mailing list it appears that you should be able to inject $filter and use it, but I'm not sure how/where to invoke it.</p>
  
  <p>My directive currently looks like this:</p>
  
  <pre><code>myApp.directive('fancyDisplay', ['$filter', function($filter) {
      return {
          scope: {
              'fancyDisplay': '='
          },
          template: "&lt;div ng-repeat='datum in fancyDisplay | filter:tagFilter'&gt;{{datum.name}}&lt;/div&gt;"
      };
  }]);
  </code></pre>
  
  <p>Although the <code>filter:tagFilter</code> isn't working.  How should I filter my data in the directive?</p>
  
  <p>JSfiddle available at <a href="http://jsfiddle.net/VDLqa/4/" rel="noreferrer">http://jsfiddle.net/VDLqa/4/</a>  Thanks in advance for any responses.</p>