i took ngTable example from
http://ng-table.com/#/loading/demo-external-array
opened it in code pen and instead of "/data" i am using an api
https://jsonplaceholder.typicode.com/posts
and added isArray : true
var Api = $resource("https://jsonplaceholder.typicode.com/posts", {}, {
'get': { method: 'GET', isArray: true}
});
in html i took out all the columns and kept "id" column for simplicity
it loads id column but searching sorting does not work.
what is it that i am doing wrong ?
changed pen is here
http://codepen.io/anon/pen/rWRNjQ
you could check this codepen, now it works. ;)
getData: function(params) {
// ajax request to api
return Api.get(params.url()).$promise.then(function(data) {
params.total(100); // recal. page nav controls
return ($filter('orderBy')(data, params.orderBy()));
//return data;
});
}
Previously there we missed the filter part.
return $filter('filter')($filter('orderBy')(data, params.orderBy()),params.filter());
for enabling filter too :)