var app = angular.module("pagingtable",['bw.paging']); app.controller('activityTableCtrl', function($scope, $http, $interval, $location, $timeout, $rootScope) { $scope.currentPage = 1; $scope.totalItems = 0; $scope.pa = 10; $scope.counter = '0'; var paused; $scope.pageSize = 100; $scope.searchText = ''; $scope.izla = 'Mahsulot nomini yozing'; getData(); $scope.menu = function(id) { location.href = id; }; function getData() { $http.get('/ajax/json/err.php?page=' + $scope.currentPage + '&size=' + $scope.pageSize + '&url=' + $scope.mc + '&search=' + $scope.searchText + '&im=' + $scope.im) .success(function(data) { $scope.title = data.title; $scope.korzinka = data.korzinka; $scope.activity = []; $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); }); }); } $scope.menu = function(id){ location.href = id; }; $scope.countdown = function() { paused = $timeout(function() { $scope.counter--; if($scope.counter <= '0'){ $scope.qa = 'Повторная отправка'; }else{ $scope.qa = 'Секун: ' + $scope.counter; $scope.see = $scope.counter; } $scope.countdown(); }, 1000); }; $scope.counter; $scope.countdown(); $scope.qayta = function(t){ $http({ method:"POST", url:"/ajax/json/err.php?e=edit", data:{'login':t} }).success(function(data){ location.replace('/reg'); }); }; $scope.tikla = function(t, user){ $http({ method:"POST", url:"/ajax/json/err.php?e=tikla", data:{'login':t, 'id':user} }).success(function(data){ location.replace('/pass'); }); }; $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.openModal = function(){ var modal_popup = angular.element('#crudmodal'); modal_popup.modal('show'); }; $scope.closeModal = function(){ var modal_popup = angular.element('#crudmodal'); modal_popup.modal('hide'); }; });