title: AngularJS - How to structure a custom filter with ng-repeat to return items conditionally
body: <p>I have an ng-repeat that prints list items. I want to write a custom filter so that the list item will print, only if a condition is true.</p>
  
  <p>I seem to have the structure wrong as it seems the variables are not getting passed through to the filter.</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;div ng-show="userDetails.username" class="nav"&gt;
      &lt;p&gt;Menu&lt;/p&gt;
      &lt;li ng-repeat="menuItem in menu | matchAccessLevel:$rootScope.userDetails.accessLevel:menuItem.minAccess | orderBy:'position' "&gt;
          &lt;a ng-href="/angular-app/app/{{menuItem.id}}"&gt;{{menuItem.name}}&lt;/a&gt;
      &lt;/li&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>userApp.filter('matchAccessLevel', function() {
      return function( item, userAccessLevel, minAccessLevel ) {
          if( userAccessLevel &gt;= minAccessLevel ) {
              return item;
          }
      }
  });
  </code></pre>