title: AngularJS, $resource, get the object from .query()
body: <p>Need get one object from .query(), service:</p>
  
  <pre><code>angular.
    module('core.users').
    factory('User', ['$resource',
      function($resource) {
        return $resource('users/users.json', {}, {
          query: {
            method: 'GET',
            isArray: true
           }
         });
        }
      ]);
  </code></pre>
  
  <p>component:</p>
  
  <pre><code>'use strict';
  
  angular.
    module('userDetail').
    component('userDetail', {
      templateUrl: 'user-detail/user-detail.template.html',
      controller: ['$routeParams', 'User', '$filter',
        function TaskDetailController ($routeParams, User, $filter) {
          var vm = this;
  
          vm.id = parseInt($routeParams["id"], 10);
          vm.users = User.query(function() {
            vm.user = $filter('currentUser')(vm.users, vm.id);
          });
        }
      ],
  
      controllerAs: 'vm'
    });
  </code></pre>
  
  <p>need to get one object from array, 'currentUser', with $routeParams id, problem - vm.user is undefined in controller scope, here </p>
  
  <pre><code>vm.users = User.query(function() {
    vm.user = $filter('currentUser')(vm.users, vm.id); // all ok, i got the object
    });
  console.log(vm.user) // undefined
  </code></pre>
  
  <p>it's ok for view, i can display properties, but need make .put() request to server with this solo object, when some of user props changed... </p>