我想使用ng-table,但是與ngTableParams卡在一起。我不斷收到錯誤:'undefined'不是構造函數(評估'ngTableParams')
[Error] Error: 'undefined' is not a constructor (evaluating 'new ngTableParams')
錯誤,無論我嘗試什麼東西。
當前的代碼看起來像
$scope.tableParams = new ngTableParams({
page: 1,
count: 200,
sorting: {
name: 'asc'
}
}, {
groupBy: 'area',
total: TheData.length,
getData: function($defer, params) {
// use build-in angular filter
var orderedData = params.sorting() ? $filter('orderBy')(TheData, params.orderBy()) : TheData;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
的應用程序和控制器與ngTable和ngTableParams調用:
angular.module('MegaList', ['ui.bootstrap', 'ngTable']);
angular.module('MegaList').controller('DisplayMegaList', ['$scope', 'ngTableParams', function($scope, $http, ngTableParams) {
...
}
我想我已經嘗試了所有的辦法來撰寫'ngTable'
,'ngTableParams'
和ngTableParams
關鍵字放在一起,但它仍然不起作用。
那我該怎麼試試?
)事實上,訂單('scope','ngTableParams',function($ scope,ngTableParams,$ http){}]' – 2015-05-23 07:03:43