gpt4 book ai didi

angularjs - 带有 body 数据的重新删除

转载 作者:行者123 更新时间:2023-12-04 15:41:53 25 4
gpt4 key购买 nike

下面是我的重新删除请求,我打算根据用户选择传递要删除的 id 数组

var deleteIds = [1,5,10]
Restangular.all('url').customDELETE(deleteIds);

我希望在正文参数中传递这个 deleteIds。我如何将数组作为正文发送,以便我可以看到请求有效负载。

最佳答案

其实我还需要使用delete http 方法在body 中传递数据,我发现Restangular 支持customOperation

文档:
https://github.com/mgonto/restangular#custom-methods

  • customOperation(operation, path, [params, headers, elem]): This does a custom operation to the path that we specify. This method is actually used from all the others in this subsection. Operation can be one of: get, post, put, remove, head, options, patch, trace


例子:
Restangular.all('some/path/123')
.customOperation('remove', '',{'content-type': 'application/json'},[1,5,10])

关于angularjs - 带有 body 数据的重新删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36720556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com