我正在尝试使用 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.onreadystatechange
ui-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?
最佳答案
尝试将 numPages 更改为属性而不是函数:
$scope.numPages = Math.ceil($scope.todos.length / $scope.numPerPage);
关于javascript - Angular-bootstrap 分页给出未定义的函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27977809/