I use angular 10 in my project. I have two functions initData1 and initData2.
I have two functions:
initData1(){
//some http client services
this.dataService.getTitleImageUrl(this.data.titlId, this.data.id )
.subscribe( resp => { this.titeImageUrl = encodeURI(resp.results[0]) });
this.storeService.getContactImageUrl(this.store.titlId, this.store.id )
.subscribe( resp => { this.contactImageUrl = encodeURI(resp.results[0]) });
}
initData2(){
//some http client services
this.dataService.getTitleImageUrl(this.data.titlId, this.data.id )
.subscribe( resp => { this.titeImageUrl = encodeURI(resp.results[0]) });
this.storeService.getContactImageUrl(this.store.titlId, this.store.id )
.subscribe( resp => { this.contactImageUrl = encodeURI(resp.results[0]) });
}
Here how I call functions in my component:
ngOnInit(): void {
initData1();
initData2();
}
My question is how to execute the initData2 function only after all httpclient services are resolved in the initData1 function?
UPDATE: add examples of http client services