我尝试使用angular-bootstrap分页页脚
我得到了错误
TypeError: undefined is not a function
at Object.fn (http://localhost:3000/lib/angular-bootstrap/ui-bootstrap-tpls.js:2265:5)
at Scope.$get.Scope.$digest (http://localhost:3000/lib/angular/angular.js:12650:29)
at Scope.$get.Scope.$apply (http://localhost:3000/lib/angular/angular.js:12915:24)
at done (http://localhost:3000/lib/angular/angular.js:8450:45)
at completeRequest (http://localhost:3000/lib/angular/angular.js:8664:7)
at XMLHttpRequest.xhr.onreadystatechange (http://localhost:3000/lib/angular/angular.js:8603:11)angular.js:10126 (anonymous function)angular.js:7398 $getangular.js:12669 $get.Scope.$digestangular.js:12915 $get.Scope.$applyangular.js:8450 doneangular.js:8664 completeRequestangular.js:8603 xhr.onreadystatechangeui-bootstrap-tpls.js:2265行是"setNumPages“
$scope.$watch('totalPages', function(value) {
setNumPages($scope.$parent, value); // Readonly variable
if ( $scope.page > value ) {
$scope.selectPage(value);
} else {
ngModelCtrl.$render();
}
});我使用bower安装了angular-bootstrap,并包含了
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',当我在angular-bootstrap存储库中搜索函数setNumPages时,我在
src/pagination/pagination.js 如何确保pagination.js也加载到我的浏览器中。我没有在我的库中找到pagination.js。我跟踪了How to do paging in AngularJS?
发布于 2015-03-25 23:50:09
尝试将numPages更改为属性而不是函数:
$scope.numPages = Math.ceil($scope.todos.length / $scope.numPerPage);发布于 2015-04-08 22:12:54
我也犯了同样的错误,我解决了这个问题->
UI中的第一项:
<pagination
total-items="vm.pagination.totalItems"
items-per-page="vm.pagination.itemsPerPage"
ng-model="vm.pagination.currentPage"
current-page="vm.pagination.currentPage"
boundary-links="true">
</pagination>Ctrl中的第二个:
var vm = this, //controllerAs: 'vm'
itemsPerPage = 10;
vm.pagination = {
currentPage: 1,
itemsPerPage: itemsPerPage,
totalItems: vm.alarms.length,
numPages: Math.ceil(vm.alarms.length / itemsPerPage)
};
$scope.$watch('vm.pagination.currentPage', function() {
var begin = ((vm.pagination.currentPage - 1) * vm.pagination.itemsPerPage),
end = begin + vm.pagination.itemsPerPage;
vm.filterAlarms = vm.alarms.slice(begin, end);
});https://stackoverflow.com/questions/27977809
复制相似问题