2016-12-02 89 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

謝謝我解決了這個問題:) –