angularjs – PUT / GET与有效载荷使用矩形

栏目: 编程语言 · AngularJS · 发布时间: 7年前

内容简介:代码日志版权声明:翻译自:http://stackoverflow.com/questions/19050880/put-get-with-payload-using-restangular

我在我的作品之一中使用了Restangular

服务器家伙给了我以下电话,我需要在AngularJS客户端上集成

> PUT api / partners / password – RequestPayload [{password,confirmpassword}]

合作伙伴ID正在标题中发送

> GET api / partners / password /忘记/ – 请求有效载荷[{emailaddress}]

合作伙伴ID正在标题中发送

我写的这些服务的JavaScript代码如下

> Restangular.all(‘Partners’).一(“密码”)put(params); – 发送params作为查询字符串

> Restangular.all(‘Partners’).一个(‘密码’).一个(“忘记”).get(params); – 在url中发送对象

我尝试过其他方式,但根本没有正确的通话.

帮我出去吧!

所以,对于第1点.它把对象放在手边,而不是另一个对象.所以你有两个选择:

选项1

var passReq = Restangular.all('Partners').one('Password');
passReq.confirmPassword = ....
passReq.put(); // confirmPassword and the params of the object will be sent

选项2是

var passReq = Restangular.all('Partners').one('Password').customPUT(obj);

对于Point#2,您不能在GET中发送请求正文(payload).

代码日志版权声明:

翻译自:http://stackoverflow.com/questions/19050880/put-get-with-payload-using-restangular


以上所述就是小编给大家介绍的《angularjs – PUT / GET与有效载荷使用矩形》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Big Java Late Objects

Big Java Late Objects

Horstmann, Cay S. / 2012-2 / 896.00元

The introductory programming course is difficult. Many students fail to succeed or have trouble in the course because they don't understand the material and do not practice programming sufficiently. ......一起来看看 《Big Java Late Objects》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码