2016-12-02 88 views
-2

我有一个代码Angularjs NG-重复指数3

$scope.filteredItems = []; 
    $scope.itemsPerPage = 10; 
    $scope.itemdata = []; 
    $scope.currentPage = 1; 
    $scope.max = 5; 
    $scope.data_berita = function() { 
$http.get('manajemen_data/berita/get_data').then(function(res) 
{ 
    $scope.itemdata = res.data; 
    $scope.currentPage = 1; //current page 
    $scope.entryLimit = 10; //max no of items to display in a page 
    $scope.filteredItems = $scope.itemdata.length; //Initially for no filter 
    $scope.totalItems = $scope.itemdata.length; 
}); 

}

她的问题是,我在一个表10自动$索引+ 1个值1-10的数据的极限显示数据。当我使用分页将页面移动到第2页$ index + 1时,我是另一个人如何当他移动他的页面时是11?

回答

0

设置$index($scope.itemsPerPage * $scope.currentPage)+1

实施例。如果你想显示第2页,那么(10 * 1)+ 1 = 11

+0

好的我会尝试你的建议 –

+1

谢谢我解决了这个问题:) –