如何使用ID数组在Angular 4中进行大规模删除 [英] How to make a massive delete in angular 4 with an array of ids

查看:57
本文介绍了如何使用ID数组在Angular 4中进行大规模删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行大规模删除,以使我拥有要删除的ID的 Array< number> .我无法将此数组作为参数传递给方法 this._httpService.delete(uri,options). _httpService 的类型为 Http .

I'm trying to make a massive delete, in order to do that I have an Array<number> of the ids I want to delete. I can't pass this array as a parameter to the method this._httpService.delete(uri,options). The type of _httpService is Http.

因此,我正在循环数组并在循环内进行单个调用,但是每个调用都是异步的,并且在循环结束时我有一定的逻辑可以运行.

So I'm looping the array and inside the loop I'm making single calls, but each call is async and I have certain logic to run when the loop ends.

推荐答案

实际上,根据因此,您的应用程序不发出数百个请求,而仅发出一个带有所有ID的请求.

So instead of issuing hundreds of requests, have your app make just one with all ids in the body.

这篇关于如何使用ID数组在Angular 4中进行大规模删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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