在过滤后更新AngularJS中的分页
- 论坛
- 在过滤后更新AngularJS中的分页
21 浏览
在过滤后更新AngularJS中的分页
我已经实现了分页功能。
现在我希望在过滤结果后更新分页。
表单:
列表:
分页:
控制器:
$scope.filter = function() { window.setTimeout(function() { //等待'filtered'被改变 $scope.noOfPages = Math.ceil($scope.filtered.length/$scope.entryLimit); $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; }, 10); };
我的问题是,分页只在点击页码或在输入框中输入下一个字符后才更新。所以它是迟一步更新的。
编辑:我在jsFiddle上添加了源代码:http://jsfiddle.net/eqCWL/2/