Update pagination in AngularJS after filtering

前端 未结 4 1462
情深已故
情深已故 2021-01-30 10:51

I already have the pagination implemented. Now I want the pagination to be updated after filtering my results.

The form:



        
4条回答
  •  花落未央
    2021-01-30 11:45

    Use angular $scope.$watch

    $scope.$watch('search', function(term) {
        $scope.filter = function() {
            $scope.noOfPages = Math.ceil($scope.filtered.length/$scope.entryLimit);
        }
    });
    

    Source ; http://jsfiddle.net/eqCWL/2/

    Demo ; http://jsfiddle.net/eqCWL/192/

提交回复
热议问题