【发布时间】:2014-09-23 19:05:12
【问题描述】:
当我调用服务和服务返回 data.length 时,我想更改分页中的总项目
当我在输入模型中点击搜索时调用的服务
在我的搜索 html 中
<form ng-submit="submit(key1.index1)" ng-controller="searchController">
<input type="text"
class="form-control"
id="inputKey1"
placeholder="Enter Key 1"
ng-model="key1.index1">
</form>
在我的索引 html 中
<div ng-controller="searchController" >
<pagination total-items="totalItems"
ng-model="currentPage"
max-size="maxSize"
class="pagination-sm"
boundary-links="true"
ng-change="pageChanged()"
items-per-page="items_per_page">
</pagination>
</div>
在我的控制器中
app.controller('searchController', function ($scope,Service) {
$scope.totalItems = 0;
$scope.submit = function (index1) {
Service.getID("test", index1).then(function (listDocc) {
$scope.totalItems = listDocc.length;
console.log( $scope.totalItems);
});
}
};
我在函数中的 $scope.roralItems 中有 20 个,但我的分页没有更新我很困惑
【问题讨论】:
标签: angularjs pagination angular-ui