How to guarantee sequential order with angular http rest api in for loop?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create a form that allows you to create multiple resources in sequential order. Example below Floor 1 Floor 2 Floor 3 ... Floor 9 The problem with the code is that the order is not guarantee. My code below let startAt = this.addAreasForm.controls['startAt'].value const name = this.addAreasForm.controls['name'].value const newArea = {name: name} for (let i = 1; i this.added.emit(area) ) } Can come back like Floor 2 Floor 3 Floor 1 Floor 5 Floor 4 How do you handle async api calls to guarantee sequential order? 回答1: You can use