There is a call to the server, it is listened to by subscribe, then it returns the object from which the data array with the order numbers is obtained. For these order numbers, I next make inquiries in a cycle, subscribe to them and push into the general array.
let collect = []; this.service.getData(url1).subscribe( res = > { // Возвращает: {Object:[{key:number},{key:number}]} orderArray = []; for (let items of res.Object) { orderArray.push(items.key); } if(orderArray) { for (let i = 0; i < orderArray.length; i++) { this.service.getData(otherUrl).subscribe( res2 = > { // {item: 'имя'} collect.push(res2.item) } ) } } } ) The problem is that I can't use collect any further. it's empty ... How to collect data?
res? In the sense - an array of users, todos, or something else? and why in the loop to make requests for the same url2url2? just correct this semantics, it will be easier for me to give you the answer - overthesanity