AngularJs中的Http Delete方法没有url绑定? [英] Http Delete Method in AngularJs with out url Binding?

查看:139
本文介绍了AngularJs中的Http Delete方法没有url绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果使用

$ http.delete('api / contacts',Id);



然后收到错误。



但是当使用这样的时候

< br $>
$ http.delete('api / contacts /'+ Id);



执行。



我不想使用URL绑定传递数据....



请帮我解决

if using
$http.delete('api/contacts', Id);

Then getting error.

But When Using Like this

$http.delete('api/contacts/'+ Id);

Executing .

I don't Want to use URL Binding To pass data....

Please Help Me To Solve

推荐答案

http.delete('api / contacts',Id) ;



然后收到错误。



但是当使用这样的时候


http.delete('api/contacts', Id);

Then getting error.

But When Using Like this


http.delete('api / contacts /'+ Id);



执行。



我不想使用URL绑定传递数据....



请帮我解决
http.delete('api/contacts/'+ Id);

Executing .

I don't Want to use URL Binding To pass data....

Please Help Me To Solve


根据Restiful API,删除规范要求你传递id。



如果你不想通过网址传递它,那么使用POST但你的应用程序将不会遵循宁静的api风格。
According to Restiful API, the delete spec requires you to pass the id.

If you don't want to pass it through the url, then use POST but then your app will not be following restful api styles.


这篇关于AngularJs中的Http Delete方法没有url绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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