Well, I think I decided it - maybe not the cleanest, but still ...
var app = angular.module("myApp", ["ngTable", "ngResource", "ngTableDemoFakeBackend"]); app.factory('orderResource', function ($resource) { return $resource('https://jsonplaceholder.typicode.com/posts'); }); (function () { app.controller("demoController", demoController); demoController.$inject = ["NgTableParams", "$resource", "orderResource", '$filter']; function demoController(NgTableParams, $resource, orderResource, $filter) { //debugger; var ordersGet = orderResource; var Api = $resource("/data"); this.tableParams = new NgTableParams({}, { getData: function (params) { // **** Section 1 *** sorting and filter does not work return orderResource.query().$promise.then(function (response) { params.total(100); return $filter('orderBy')($filter('filter')(response, params.filter()), params.orderBy()) // **** Section 1 *** //****Section 2 *** this works fine // return Api.get(params.url()).$promise.then(function(data) { // params.total(data.inlineCount); // return data.results; //****Section 2 *** }); } }); } })();
I applied the $ filter service, and I order the results of the table with this filter (I already have the sort order for the component)
source share