Pagination does not work after loading JSON data on Ng-Table

I followed the http://bazalt-cms.com/ example for pagination, but using a $http.getvariable in the controller instead of hard coding.

  $http.get("data.json").success(function(data){
       $scope.dataset = data;
   }

I also moved $scope.tableParamsinside$http.get

$http.get("data.json").success(function(data){
     $scope.dataset = data;

     $scope.tableParams = new ngTableParams({
      ...
    }
});

and changed the variable datato$scope.dataset

total: $scope.dataset.length, // length of data
getData: function($defer, params) {
        $defer.resolve($scope.dataset.slice((params.page() - 1) * params.count(), params.page() * params.count()));}

Everything works fine, except that the page does not work. See here Plnkr

+4
source share
2 answers

ng-table . , $data data, . $data data , dataset.

Plunker. >

:

, , , . , $data <tr ng-repeat="user in $data"> <tr ng-repeat="user in dataset">. , data dataset .

+8

ng-
ng-repeat $data ngtableParams success getData acsess

0

All Articles