How to achieve pagination with ngTable ngResource and oData

is there a good example of server pagination using ngTable and ngResource.

I am loading a table like this

    function getStoreCommands() {
        $scope.data = storeCommandResource.query();

        return $scope.data.$promise.then(function (response) {
            $scope.data = response;
            $scope.$watch("data.query", function () {
                $scope.storeCommandsTableParams.reload();
            });
            $scope.storeCommandsTableParams = new ngTableParams({
                page: 1,            // show first page
                count: 10,          // count per page

      

etc.............................................. ................

where storeCommandResource uses ngResource. I only want to load the first 10 records according to my ngTableParams, and when someone clicks on another page it has to download the data of that page from the server.

I have classic oData server side REST web Api functionality to support ngResource.

kind help.

+3


source to share





All Articles