We have adopted Angular for our project. Our component receives data from an API, which is then processed by Data Services. These services transform the data by combining first and last names, rounding dollar amounts, performing calculations, etc. The final step involves populating the Sales year in a Dropdown menu after parsing all the information.
this.webStoreSearchHttpService.GetAllCustomerSalesData(this.customerId).subscribe((response) => {
this.customerList = customerDataService.createCustomerList(response);
this.productList = customerDataService.createProductAnalysis(response);
this.salesList = customerDataService.createSalesList(response);
this.salesYearList = customerDataService.createYearList(response);
this.salesYearItemCurrent = _.cloneDeep(this.salesYearList[0]); <--- this is used for a Mat Select Dropdown
However, the correlated data does not appear in the web dropdown selection because the Data Services are not finished parsing/creating yet, even though they are called within the original API subscribe function.
My goal is to ensure that all four Data Services are completely executed before populating the salesYear. Is there a way to achieve this using Angular typescript?
The Data Services can be executed in parallel, but the final step of populating the salesYear in the dropdown must follow.
Note that the methods return class arrays, not promises or observables.