参数变量的 ngTable 指令问题
ngTable directive issue with params variable
我正在为 grid.I 使用 ngTable 指令,需要根据我的 controller.Let 设置页数,也就是说我需要将页面大小设置为 [=30= 】 我可以吗?如何从我的控制器访问 params
变量?
我试过 below.But 它抛出异常 TypeError: Cannot read property 'count' of undefined
$scope.params.count(50);
Html
<button type="button" ng-class="{'active':params.count() == 50}" ng-click="params.count(50)" class="btn btn-default">50</button>
js
$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()));
}
});
count 是一个 属性,你的作用域中没有 params 变量,但有一个 tableParams...tableParams.count
看起来更好
$scope.tableParams.count(50);
我正在为 grid.I 使用 ngTable 指令,需要根据我的 controller.Let 设置页数,也就是说我需要将页面大小设置为 [=30= 】 我可以吗?如何从我的控制器访问 params
变量?
我试过 below.But 它抛出异常 TypeError: Cannot read property 'count' of undefined
$scope.params.count(50);
Html
<button type="button" ng-class="{'active':params.count() == 50}" ng-click="params.count(50)" class="btn btn-default">50</button>
js
$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()));
}
});
count 是一个 属性,你的作用域中没有 params 变量,但有一个 tableParams...tableParams.count
看起来更好
$scope.tableParams.count(50);