How to use ng-if with ng-repeat?

Chris提出了一个问题:How to use ng-if with ng-repeat?,或许与您遇到的问题类似。

回答者Cuong Vo给出了该问题的处理方式:

There's probably a better solution, but after reading the replies above, you can try making your own custom filter:

angular.module('yourModule').filter('filterNavItems', function() {
  return function(input) {
    var inputArray = [];

    for(var item in input) {

    return inputArray.filter(function(v) { return v.nav; });

Then to use it:

<section class="nav">
    <a  ng-repeat="(key, item) in routes | filterNavItems"

Here's the Plunker: