title: Get response header in then() function of a ngResource object's $promise property after resource resolved?
body: <p>I'm willing to retrieve the response header of a resource request, cause I've put pagination information and something else in it rather than the response body, to make the REST api clear.</p>
  
  <p>Though we can get it from the success / error callback like below:</p>
  
  <pre><code>Object.get({type:'foo'}, function(value, responseHeaders){
      var headers = responseHeaders();
  });
  </code></pre>
  
  <p>Where 'Object' is my resource factory service.</p>
  
  <p>Further, when I'm trying to make the route change after required resources resolved, I've tried this:</p>
  
  <pre><code>.when('/list', {
      templateUrl: 'partials/list.html',
      controller: 'ListCtrl',
  
      // wait for the required promises to be resolved before controller is instantialized
      resolve: {
          objects: ['Object', '$route', function(Object, $route){
              return Object.query($route.current.params).$promise;
          }]
      }
  })
  </code></pre>
  
  <p>and in controller, just inject "objects" instead of Object service, because it's resolved and filled in with real data.</p>
  
  <p>But I got problem when I try to get headers info from the "objects" in controller.</p>
  
  <p>I tried <code>objects.$promise.then(function(data, responseHeaders){})</code>, but responseHeader was undefined.</p>
  
  <p>How can I change the $resource service's behavior so that it throws the responseHeader getter into the $promise then() callback function?</p>
  
  <p>My service "Object" for reference:</p>
  
  <pre><code>myServices.factory('Object', ['$resource',
      function($resource){
          return $resource('object/:id', {id: '@id'}, {
              update: {method: 'PUT'},
          });
      }
  ]);
  </code></pre>