1
我有分頁我的網頁上時(在單頁行) 時變化頁碼第一它變成行了片刻,然後下一個其中顯示。Angularjs - 在導航NG-重複顯示更多行randering
我想改善用戶體驗,當他更改頁碼時,他不會有任何UI干擾的感覺。
這是我的分頁代碼。
$scope.currentPage = cPage
, $scope.numPerPage = PerPage
, $scope.maxSize = maxNavSize;
$scope.numPages = function() {
return Math.ceil(dataLength/$scope.numPerPage);
};
if (watchFun)
watchFun()
watchFun = $scope.$watch('currentPage + numPerPage', function (newValue, oldValue) {
$scope.cPage = $scope.currentPage;
var begin = (($scope.currentPage - 1) * $scope.numPerPage),
end = begin + $scope.numPerPage;
// ajax call to get data for each page
$http({
url: url+ '?'+data + "&offset=" + begin + "&limit=" + PerPage,
method: "GET",
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}) .success(function (response) {
if (response.length != 0) {
$scope.historyContest =[];
$scope.historyContest = response;
}
});
});
$ scope.historyContest代表NG-重複這樣它會爲每個頁面更改。
如果您有任何疑問,請讓我知道我會更新它。
謝謝
是的嘗試過但不工作 – naCheex