I am currently working on setting up a server-side table using ng-table. However, I am encountering some issues with the getData
function. It keeps giving me errors such as $defer.resolve is not a function
or params is not defined
.
I noticed that I can access the params
variable when I don't use $defer
in the getData
function.
Here's a snippet of my code:
angular.module('ngTableTest', ['ui.router', 'ngTable'])
.controller('Table', function($state, NgTableParams){
var vm = this;
vm.niceTable = new NgTableParams({}, {
getData: function($defer, params) {
$http.get('/app/getdata')
.success(function(data) {
params.total(data.count);
$defer.resolve(data.data);
});
}
});
});
Any insights would be greatly appreciated!