AngularJS $资源自定义页眉 [英] AngularJS $resource custom headers

查看:221
本文介绍了AngularJS $资源自定义页眉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一对夫妇的了解,出现问题后,我遇到了真的很难probs。我不能让我的自定义页眉上从AngularJS的$要求工作。我的定义是这样的:

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'
        }
    }
});

另外这里的jsfiddle

这是问题仍然有效?
是否有另一种方式来设置自定义页眉?
感谢您的帮助! :)

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

推荐答案

我相信,你必须退回到$ HTTP进行自定义标题。我也希望完成类似的任务,但也没有办法使用$资源去做。

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.

这篇关于AngularJS $资源自定义页眉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆