first inject $filter
in controller
controller('DemoCtrl', function($scope, $filter, ngTableParams) {
second, you need to apply ng-repeat
to $data
variable like this
<tr ng-repeat="g in $data">
Update
here working plunk, with all edits above, and angular 1.2.26
and ngtable 0.3.1
Update2
you can bind $scope.tabledata
if your view is needed,after data retrieving in getData
function
getData: function($defer, params) {
// use build-in angular filter
filteredData = params.filter() ?
$filter('filter')(tabledata, params.filter()) :
tabledata;
var orderedData = params.sorting() ?
$filter('orderBy')(filteredData, params.orderBy()) : filteredData;
var page=orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count());
$scope.tabledata=page;
$defer.resolve(page);
}
tabledata
. I am using$tabledata
in the view – Circumstantial$data
,otherwise it will be strange behavior,but that's not big deal,cause you can put all data access logic fortabledata
insidegetData
function – Highcolored$tabledata
for view needing afterngtable
resolving – Highcolored