How to use ng-if with ng-repeat?

后端 未结 5 1047
北恋
北恋 2020-11-30 13:40

I have a simple nav object setup that lists the nav items (and whether they should appear in the primary nav or not). It seems though when I try to mix ng-if with ng-repeat,

5条回答
  •  被撕碎了的回忆
    2020-11-30 14:02

    How about this one-liner using $filter:

    $scope.filteredRoutes = $filter('filter')($scope.route.routes, function(route){
      return route.nav;
    });
    

提交回复
热议问题