$scope.tableParams = new ngTableParams({
count: 5,
sorting: {
id: 'desc'
}
}, {
getData: function (params) {
// Call api
var orderBy, order;
for (orderBy in params.sorting()) {
order = params.sorting()[orderBy];
break;
}
return UserService.getUsers({
skip: (params.page() - 1) * params.count(),
limit: params.page() * params.count(),
sort: orderBy + ' ' + order,
search: $scope.search
})
.$promise.then(function (response) {
params.total(response.total);
$scope.users = response.data;
return response.data;
});
}
});
response.data.map(function(u){
u.sortName = u.userName.toLowerCase();
});