Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS $resource custom headers

after a couple of understanding-problems, I have run into really hard probs. I can't get my custom headers to work on the $request from AngularJS. My definition looks like this:

$scope.re = $resource('/', {
    callback: 'JSON_CALLBACK'
    }, {
    'updateCart': {
        method: 'POST',
        headers: {
            'module': 'Shop',
            'mod_id': '1',
            'event': 'updateCart'
        }
    }
});

Also here JSFIDDLE

Is this Issue still active? Is there another way to set custom headers? Thanks for any help! :)

like image 218
Preexo Avatar asked Nov 05 '12 13:11

Preexo


1 Answers

I believe you have to fallback to $http for custom header. I was also looking to accomplish similar task but there is no way to do it using $resource.

like image 97
Jigar Patel Avatar answered Nov 08 '22 09:11

Jigar Patel