Monday, 15 April 2013

angularjs - How can I get my ngResource to accept custom headers? -



angularjs - How can I get my ngResource to accept custom headers? -

my code in coffeescript :

resource = $resource globalservice.apiroot + "stuffs", {}, get: method: "get" headers: "accept": "application/stuffs;version=3" "authorization": 'token token="' + $.cookie('token') + '"'

my code in javascript :

var resource; resource = $resource(globalservice.apiroot + "stuffs", {}, { get: { method: "get", headers: { "accept": "application/stuffs;version=3", "authorization": 'token token="' + $.cookie('token') + '"' } } });

then when do..

resource.get ->

it doesn't send out specified headers, , effectually fails cors authorization.

any recommendations?

looks headers setting available in latest "unstable" release of angular. if utilize this, sure upgrade both angular.js , angular.resource.js 1.1.2 (current unstable release).

http://code.angularjs.org/1.1.2/angular.js http://code.angularjs.org/1.1.2/angular-resource.js

angularjs

No comments:

Post a Comment