Using ng-repeat and filter, how to tell which items are visible?

后端 未结 3 1031
后悔当初
后悔当初 2021-01-04 08:36

I have an array of objects that I\'m displaying in my Angular app using ng-repeat. I\'m filtering out items using filter and the value of a search

3条回答
  •  我在风中等你
    2021-01-04 09:09

    You can bind the filtered array to another scope variable in your view, then access that in your controller.

    View:

    
      ...
    
    

    Controller:

    $scope.toggleAll = function () {
      angular.forEach($scope.filteredItems, function (item) {
        // do stuff
      })
    }
    

提交回复
热议问题