mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-16 20:32:21 +01:00
32 lines
909 B
JavaScript
32 lines
909 B
JavaScript
'use strict';
|
|
|
|
angular.module('users.admin').controller('UserListController', ['$scope', '$filter', 'Admin',
|
|
function ($scope, $filter, Admin) {
|
|
Admin.query(function (data) {
|
|
$scope.users = data;
|
|
$scope.buildPager();
|
|
});
|
|
|
|
$scope.buildPager = function () {
|
|
$scope.pagedItems = [];
|
|
$scope.itemsPerPage = 15;
|
|
$scope.currentPage = 1;
|
|
$scope.figureOutItemsToDisplay();
|
|
};
|
|
|
|
$scope.figureOutItemsToDisplay = function () {
|
|
$scope.filteredItems = $filter('filter')($scope.users, {
|
|
$: $scope.search
|
|
});
|
|
$scope.filterLength = $scope.filteredItems.length;
|
|
var begin = (($scope.currentPage - 1) * $scope.itemsPerPage);
|
|
var end = begin + $scope.itemsPerPage;
|
|
$scope.pagedItems = $scope.filteredItems.slice(begin, end);
|
|
};
|
|
|
|
$scope.pageChanged = function () {
|
|
$scope.figureOutItemsToDisplay();
|
|
};
|
|
}
|
|
]);
|