title: With AngularJS, I don't want to set the global $http.defaults.headers.common. Can I send my custom header with each $resource call?
body: <p>I'm calling a back-end server that I cannot control.  Currently it's using jQuery ajax like this:</p>
  
  <pre><code>return $.ajax({
      type: "POST",
      url: "/api/cases/store",
      contentType: "application/json",
      data: JSON.stringify(parameters),
      headers: { "Authorization": cred } : {}
  }) // ... etc.
  </code></pre>
  
  <p>I want to convert it to use the <code>$resource</code> service, and got it working doing this</p>
  
  <pre><code>$http.defaults.headers.common['Authorization'] = cred;
  return $resource('/api/cases/store').save();
  </code></pre>
  
  <p>The only problem is that I'm having to set the global <code>$http</code> service defaults with the auth credentials.</p>
  
  <p>I am seeing that you're supposed to be able to pass in custom headers with the <code>$http</code> call, and now with <code>$resource</code> calls, but I can't find any examples of how to do it in my case (with  a POST).</p>
  
  <p>I also can't find anything on this in the AngularJS documentation.   How do you guys figure this stuff out?  The docs are so bad!</p>