var app = angular.module("pagingtable",['bw.paging']); app.controller('activityTableCtrl', function($scope, $http) { $scope.currentPage = 1; $scope.totalItems = 0; $scope.pageSize = 4; $scope.searchText = ''; $scope.minText = '0'; $scope.maxText = '0'; $scope.category = ''; $scope.rang = ''; $scope.minText = '0'; $scope.maxText = '1000'; $scope.pa = 100; $scope.viloyatText = ''; getData(); function getData() { $http.get('/json.php?page=' + $scope.currentPage + '&size=' + $scope.pageSize + '&viloyat=' + $scope.viloyatText + '&search=' + $scope.searchText + '&min=' + $scope.minText + '&max=' + $scope.maxText + '&category=' + $scope.category + '&rang=' + $scope.rang + '&pa=' + $scope.pa) .success(function(data) { $scope.activity = []; $scope.mes = []; $scope.olcham = []; $scope.firmani= []; $scope.totalItems = data.totalCount; $scope.startItem = ($scope.currentPage - 1) * $scope.pageSize + 1; $scope.endItem = $scope.currentPage * $scope.pageSize; if ($scope.endItem > $scope.totalCount) {$scope.endItem = $scope.totalCount;} angular.forEach(data.Biodata, function(temp){ $scope.activity.push(temp); }); angular.forEach(data.menu, function(temp){ $scope.mes.push(temp); }); angular.forEach(data.firmaga, function(temp){ $scope.firmani.push(temp); }); angular.forEach(data.ol, function(temp){ $scope.olcham.push(temp); }); }); } $scope.qosh = function(name, md5, v) { $http({ method:"POST", url:"/json.php?e=e", data:{'id': v, 'md5': md5} }).success(function(data){ $scope.pa = 12; $scope.currentPage = 1; getData(); }); } $scope.razz = function(name, md5, v) { $http({ method:"POST", url:"/json.php?z=z", data:{'id': v, 'md5': md5} }).success(function(data){ $scope.currentPage = 1; getData(); }); } $scope.auu = function(name, md5, v) { $http({ method:"POST", url:"/json.php?au=au", data:{'id': v, 'md5': md5} }).success(function(data){ $scope.currentPage = 1; getData(); }); } $scope.clearAllFilters = function() { $http({ method:"GET", url:"/json.php?t=t" }).success(function(){ $scope.currentPage = 1; $scope.minText = '0'; $scope.maxText = '1000'; $scope.pa = 100; getData(); }); } $scope.pageChanged = function(text, page, pageSize, total) { $scope.currentPage = page; getData(); } $scope.pageSizeChanged = function() { $scope.currentPage = 1; getData(); } $scope.searchTextChanged = function() { $scope.currentPage = 1; getData(); } $scope.minTextChanged = function() { $scope.currentPage = 1; getData(); } $scope.paTextChanged = function(s) { $scope.pa = $scope.pa + 12; $scope.currentPage = 1; getData(); } $scope.maxTextChanged = function() { $scope.currentPage = 1; getData(); } });