text: (function () {
    'use strict';
  
    angular
      .module('users.admin')
      .controller('UserListController', UserListController);
  
    UserListController.$inject = ['$scope', '$filter', '$window', 'AdminService'];
  
    function UserListController($scope, $filter, $window, AdminService) {
      var vm = this;
      vm.buildPager = buildPager;
      vm.figureOutItemsToDisplay = figureOutItemsToDisplay;
      vm.pageChanged = pageChanged;
  
      Promise.all([
        AdminService.query().$promise
      ])
        .then(function (results) {
          vm.users = results[0];
          $scope.$apply(vm.buildPager);
        });
  
      function buildPager() {
        vm.pagedItems = [];
        vm.itemsPerPage = 15;
        vm.currentPage = 1;
        vm.figureOutItemsToDisplay();
      }
  
      function figureOutItemsToDisplay() {
        vm.filteredItems = $filter('filter')(vm.users, {
          $: vm.search
        });
        vm.filterLength = vm.filteredItems.length;
        var begin = ((vm.currentPage - 1) * vm.itemsPerPage);
        var end = begin + vm.itemsPerPage;
        vm.pagedItems = vm.filteredItems.slice(begin, end);
      }
  
      function pageChanged() {
        vm.figureOutItemsToDisplay();
      }
  
    }
  }());
  