title: Use json object as variable in controller via ngResource
body: <p>I fetch json data via ngResource angular, it is easy to use in view by using <code>{{ }}</code> but i don't know how to put these json objects to variable.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var workersServices = angular.module('workersServices', ['ngResource']);
  workersServices.factory('Worker', ['$resource',
      function($resource){
          return $resource('workers/:workerId.json', {}, {
              query: {method:'GET', params:{workerId:'workers'}, isArray:true}
          });
      }]);
  
  
  var workersControllers = angular.module('workersControllers', []);
  workersControllers.controller('costsCtrl', ['$scope','Worker', function($scope, Worker) {
      $scope.workers = Worker.query();
    
           HERE I WANT NAME PROPERTY AT THAT SCOPE :
            **$scope.janeDoeName = workers[0].name;    ??? IT DOESNT WORK**
    }]);
  
  JSON DATA    workers.json 
  
  [
      {
          "id": "jane-doe",
          "name": "Jane Doe",
          "department": "sales",
          "period": {
              "start": "2015-12-14",
              "finish": "2018-12-14",
              "periodOfNotice": false
          },
          "paymentHour": 20,
          "hours": 168
      }]</code></pre>
  </div>
  </div>
  </p>
  
  <p>I just want to put chosen property from that json to $scope and use it later in some functions.</p>