title: POST data using $resource
body: <p>DEMO: <a href="http://jsfiddle.net/rob_balfre/7QUUf/" rel="nofollow">http://jsfiddle.net/rob_balfre/7QUUf/</a></p>
  
  <p>How do you POST data (across domain) using $resource? </p>
  
  <p>For example this curl writes to the API with no problem: </p>
  
  <pre><code>curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"name": "Wobbly"}' http://192.168.91.20/api/food/
  </code></pre>
  
  <p>and the header response is:</p>
  
  <pre><code>HTTP/1.0 201 CREATED
  Date: Thu, 25 Oct 2012 08:19:42 GMT
  Server: WSGIServer/0.1 Python/2.6.1
  Access-Control-Allow-Headers: Content-Type,*
  Location: http://localhost/api/food/15/
  Access-Control-Allow-Credentials: true
  Access-Control-Allow-Origin: *
  Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
  Content-Type: text/html; charset=utf-8
  </code></pre>
  
  <p>I'm totally stuck on how to get angular to POST the same way.  This is my $resource, it's worth noting that 'get' works just fine:</p>
  
  <pre><code>angular.module('tastypieModule', ['ngResource']).
  factory('FoodOptions', function($resource, $timeout) {
     var FoodOptions = $resource('http://testurl/api/:type',
          {type: 'food'},
          {
              get: {method: 'JSONP', params: {format: 'jsonp', callback:'JSON_CALLBACK'}},
              update: {method: 'POST', headers: {'Content-Type': 'application/json'}}
          }
      );
  
   return FoodOptions;
  })
  </code></pre>
  
  <p>When I call update it just fails and I see this is the console network tab:</p>
  
  <pre><code>METHOD: OPTIONS 
  STATUS: (canceled) Load cancelled
  </code></pre>