如何将主体添加到 Angular HttpClient 删除功能 [英] How to add a body to Angular HttpClient delete function

查看:32
本文介绍了如何将主体添加到 Angular HttpClient 删除功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的项目正在迁移到 Angular4,并使用 @angular/common/http Httpclient 作为默认网络工具.但是我发现删除函数中没有 body 参数.如何添加正文以删除功能?谢谢.

Our project is migrating to Angular4, and use @angular/common/http Httpclient as the default network tool. But I found there are no body params in delete function. How do I add the body to delete function? Thanks.

推荐答案

您可以改用 HttpClient 类上的通用 request 方法.此方法在选项中具有主体.https://angular.io/api/common/http/HttpClient#members

例如this.http.request('delete', 'url', { body: ... })

You may use a universal request method on the HttpClient class instead. This method has the body in options. https://angular.io/api/common/http/HttpClient#members

e.g this.http.request('delete', 'url', { body: ... })

这篇关于如何将主体添加到 Angular HttpClient 删除功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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