AngularJS uib分页功能上的更改

AngularJS uib分页功能上的更改,angularjs,pagination,Angularjs,Pagination,我无法调用带有ng change标签的函数。分页应列出迄今为止的所有日历周(38),并应在页面上列出所选日历周。我需要知道如何在getData函数上调用$scope.currentPage,以更新更改周 <uib-pagination total-items="totalItems" ng-model="currentPage" max-size="maxSize" boundary-link-numbers="true" ng-change="pageChanged()"><

我无法调用带有ng change标签的函数。分页应列出迄今为止的所有日历周(38),并应在页面上列出所选日历周。我需要知道如何在getData函数上调用
$scope.currentPage
,以更新更改周

<uib-pagination
total-items="totalItems"
ng-model="currentPage"
max-size="maxSize"
boundary-link-numbers="true"
ng-change="pageChanged()"></uib-pagination>

$scope.pageChanged = function() {
  getData();
};
$scope.totalItems = 7;
$scope.currentPage = 1;
$scope.maxSize = 38;

function getData() {
  $http.get($auth.apiUrl() + '/api/status?cweek=' + $scope.currentPage).then(function(response) {
    $scope.getData = response.data;
  },
  function(error) {
    alert("Could not fetch data from /api/status");
  });
}

$scope.pageChanged=函数(){
getData();
};
$scope.totalItems=7;
$scope.currentPage=1;
$scope.maxSize=38;
函数getData(){
$http.get($auth.apiUrl()+'/api/status?cweek='+$scope.currentPage)。然后(函数(响应){
$scope.getData=response.data;
},
函数(错误){
警报(“无法从/api/status获取数据”);
});
}
工作代码:

controller.js

$scope.api = 'https://mysite';
$scope.getData = [];
$scope.numPages = moment().week();
$scope.currentPage = moment().week() -1;
$scope.maxSize = 5;

function callApi(callback) {
  $scope.currentPage = callback;
  $http.get($scope.api + '/api/status?cweek=' + ($scope.currentPage)).then(function(response) {
    $scope.getData = response.data;
    // dont know how totalItems calculation is done but with this pagination will show all calendar weeks till todays week
    $scope.totalItems = $scope.getData.length * 55;
  },
  function(error) {
    alert("Could not fetch data from /api/status");
  });
}
  $scope.pageChanged = function() {
  callApi($scope.currentPage);
  console.log('Page changed to: ' + $scope.currentPage);
};

callApi($scope.currentPage);
index.html

<ul uib-pagination total-items="totalItems" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" num-pages="numPages" ng-change="pageChanged()"></ul>