1
我想改变我的总项在分页时,我打电话的服务和服务回报data.length我总项如何更新角度的UI分页
当我点击输入模型搜索服务名为
在我的搜索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,但我的分页它不更新我很迷惑
错误= $摘要已在进行中 – user3792381 2014-09-23 10:11:56
因此,您需要检查是否正在进行中的$摘要,如果其没有使用$ scope。$ apply();为此,你需要这样做if(!scope。$$ phase){$ scope。$ apply()} – RootHacker 2014-09-23 10:35:49
如何检查$ digest,因为我从不在控制器中使用$ digest。 p.s.thank you – user3792381 2014-09-23 10:57:20