I am using Ng-table to show humungous amount of data I get from a REST API.
The Problem
Since there is a lot of data, I apply a lot of filters and sorting in the table. I want the table state to remain in the same way even on a hard refresh.
Possible Solutions
I know there are two ways I can do it.
1.By saving the ngTableparams to the local storage and retrieving it.
2.By storing all the filter and sorting parameters in the URL itself.
Unfortunately both the options are not at all documented in the Ng-table documentation and I'm not able to move forward.
I am using Ng-table to show humungous amount of data I get from a REST API.
The Problem
Since there is a lot of data, I apply a lot of filters and sorting in the table. I want the table state to remain in the same way even on a hard refresh.
Possible Solutions
I know there are two ways I can do it.
1.By saving the ngTableparams to the local storage and retrieving it.
2.By storing all the filter and sorting parameters in the URL itself.
Unfortunately both the options are not at all documented in the Ng-table documentation and I'm not able to move forward.
$scope.tableParams = new NgTableParams(angular.extend({ page: 1, count: 25, sorting: { Id: "asc" } }, $location.search()), { total: 0, counts: [5, 10, 25, 50], getData: function ($defer, params) { if (!firstLoad) { $location.search(params.url()); } firstLoad = false; $defer.resolve(data); } });
But this is throwing the following errors:
$defer.resolve is not a function Cannot read property 'url' of undefined
What am I doing wrong here?