<div ng-repeat=" x in z"> <div ng-if="function(x).y" > display this </div> </div>
请检查并建议我是否遗漏了任何东西?
这是工作的例子
原文链接:https://www.f2er.com/angularjs/141581.htmlangular.module('app',[]) .controller('ctrl',function($scope) { $scope.z = [1,2,3]; $scope.display = function(x) { return x === 2 }; }); <div ng-app="app" ng-controller='ctrl'> <div ng-repeat=" x in z"> <div ng-if="display(x)" > display this </div> </div> </div>
和fiddle.