text: 'use strict';
  
  angular.module('cloudworkerApp')
      .controller('WorkerController', function ($scope, $state, Worker, ParseLinks) {
  
          $scope.workers = [];
          $scope.predicate = 'id';
          $scope.reverse = true;
          $scope.page = 1;
          $scope.loadAll = function() {
              Worker.query({page: $scope.page - 1, size: 20, sort: [$scope.predicate + ',' + ($scope.reverse ? 'asc' : 'desc'), 'id']}, function(result, headers) {
                  $scope.links = ParseLinks.parse(headers('link'));
                  $scope.totalItems = headers('X-Total-Count');
                  $scope.workers = result;
              });
          };
          $scope.loadPage = function(page) {
              $scope.page = page;
              $scope.loadAll();
          };
          $scope.loadAll();
  
  
          $scope.refresh = function () {
              $scope.loadAll();
              $scope.clear();
          };
  
          $scope.clear = function () {
              $scope.worker = {
                  status: null,
                  id: null
              };
          };
      });
  