I have data coming from three different services, i would like to combine data from all services into one method
this.data1 = this.activity1Service.getAllMonth();
this.data2 = this.activity2Service.getAllMonth();
this.data3 = this.activity3Service.getAllMonth();
this.alldata = concat (this.data1,this.data2,this.data3);
and call as an Observable
GetAllData(): Observable<Data[]>{
return (this.alldata);
}
And then perhaps do ngOnInit()
ngOnInit() {
this.dataService.getAllData().subscribe(aldata => this.AllData = aldata);
}
I am not sure how to combine data coming from different services into one method, can anyone please help.
forkJoin,combineLatestormergeis what you're looking for.