我是AngularJS的新手,正在尝试学习。 我被困在某个地方,找不到任何东西。我正在尝试进行分页:
JS代码...
$scope.data = [];
$scope.currentPage = 0;
$scope.pageSize = 2;
$scope.q = '';
$scope.getData = function() {
// needed for the pagination calc
// https://docs.angularjs.org/api/ng/filter/filter
return $filter('filter')($scope.data, $scope.q)
}
$scope.numberOfPages = function() {
return Math.ceil($scope.getData().length / $scope.pageSize);
}
$scope.getJSONData = function(lst) {
$scope.data.push(lst);
}
// $scope.paginationPage();
}]);
app.filter('startFrom', function() {
return function(input, start) {
start = +start; //parse to int
var result = input.slice(start);
return result;
}
......
我收到错误错误:Error: [$injector:unpr]
M DOM看起来像:
<tr ng-repeat="p in data | startFrom:currentPage*pageSize |
limitTo:pageSize">
<td class="slds-cell-shrink" style="border:groove;">
<label class="slds-checkbox testclass">
<input type="checkbox" ng-model='p.vlcSelected' ng-change='onSelectItem(control, p, $index, this)'/>
<span class="slds-checkbox--faux"></span>
<span class="slds-assistive-text">Select</span>
</label>
</td>
任何人都可以帮忙吗?