The problem is that when i get responses, they are not in the right order, for example, I get 1.name, 3.name, 4.name, 2.name, 5.name. How can I get responses in right order, like in devIds array?
var devIds = ['1', '2', '3', '4', '5']
devIds.map(function(id){
DeviceService.getDevInfo(id).then(function(response){
console.log(response.name)
})
})
I had pretty much the same problem in React but I fixed it like this
axios.all(array.map(el => axios.get(`/item/${el}`)))
.then(data => console.log(data));
Here I am trying something like this and it doesnt work
Promise.all(devIds.map(function(el){DeviceService.getDevInfo(el)}))
.then(function(res){console.log(res)});