Angular.js. How to count ng-repeat iterations which satisfy the custom filter

后端 未结 4 798
失恋的感觉
失恋的感觉 2020-11-28 11:48

Here\'s my code:

Filter:

Kb.filter(\"notEmpty         


        
4条回答
  •  清酒与你
    2020-11-28 12:26

    The easiest way may be to run the filter in your controller. Something like this:

    function MyCtrl($scope, notEmptyFilter)
    {
        //$scope.items is put into the scope somehow
        $scope.filteredItems = notEmptyFilter($scope.items);
    }
    

    Then your HTML would look something like this:

提交回复
热议问题