I have am following the first example of ng-table (http://bazalt-cms.com/ng-table/example/1).
Everything seems to work except tableParams. As soon as I include it in the controller nothing is display in the page.
The difference between the example and my code is that I load data from a json service:
angular.module('mean.cars').controller('CarsController', ['$scope', '$stateParams', '$location', 'Global', 'Cars',
function ($scope, $stateParams, $location, Global, Cars, ngTableParams) {
$scope.global = Global;
var data = Cars.query();
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 10 // count per page
}, {
total: data.length, // length of data
getData: function($defer, params) {
$defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
Cars.query(); is working well (tested it). So what am I missing? There is a javascript error: "undefined is not a function occuring" at the following line:
$scope.tableParams = new ngTableParams({