title: How to filter data based on the scope in AngularJS?
body: <p>I have the following simplified <a href="http://plnkr.co/edit/pNGTfLMJcwzn9NDYheel?p=preview" rel="nofollow">plunker</a> to demonstrate my issue:</p>
  
  <p>html:</p>
  
  <pre><code>&lt;my-directive ng-repeat="question in questions | filter:{show:true}" data-question="question"&gt;    &lt;/my-directive&gt;
  </code></pre>
  
  <p>directive:</p>
  
  <pre><code>app.controller('MainCtrl', function($scope) {
    $scope.questions = [
      {qid:'1', show: true, text:'what is?'},
      {qid:'2', show: false, text:'who is?'},
      {qid:'3', show: true, text:'where is?'}
   ];
  });
  
  app.directive('myDirective', function() {
  return {
    link: function(scope){
      scope.getShow = function(){
        // some logic to determine show
        // for simlicity , always return true so all questiosn show
        return true;
      };
    },
    restrict: "E",
    scope: {
      question: "="
    },
    template: '&lt;h1&gt;{{question.text}}&lt;/h1&gt;'
    };
  });
  </code></pre>
  
  <p>Currently, the filter works based on the 'show' value that comes from the raw data model. but i am trying to clean it from raw data and make it work based on the <code>getShow()</code> logic that is defined at the question's scope level. </p>
  
  <p>Generally, I cannot figure out a way to filter based on fields or functions on the scope, rather than on the data model, and could not find an example of how this could be done. </p>