I have to make multiple API calls(http-requests) to get all the data I need.
Since I have to make 2 independent API calls that both should be finished with retrieving data, I am trying to sync to that.
I have nearly 0 experience in typescript/angular and couldn't find a solution via google.
Here are the API calls I'm making(signatures):
public supportedLanguages(observe?: 'body', reportProgress?: boolean): Observable<Array<string>>;
public getAllFilters(acceptLanguage?: string, observe?: 'body', reportProgress?: boolean): Observable<Array<Filter>>;
Here is the code I am currently using to fill Array<Type>:
this.langService.supportedLanguages().subscribe(langs => setTimeout(() =>
this.langs.push(...langs), 1000));
this.categorieService.getAllFilters('de').subscribe(categories => setTimeout(() => {
this.categories.push(...categories), 1000));
I am guessing that this is not the right approach to retrieving the data, but I haven't found a better way(I am very new to typescript/angular).
What are the right steps to take to wait for said data to be loaded?