I am using a few backend services to populate three columnns with Material Designs data table. I am using an observable to populate the data Source data. but how do I include the data from the other services. So far I am only able to use data from one Service. My thought process was to use a .push to the data Source.
dataSource = []
constructor(public data: xService, public otherData: yService) { }
submit() {
this.data.getUsers().subscribe(data => {
this.dataSource = data.rows;
});
this.otherData.getUnitAssignments().subscribe(otherData => {
this.dataSource.push({ assignments: otherData });
});
}
Services Files
export interface xresponse {
rows: Array < string > ,
}
constructor(private http: HttpClient) {}
getUsers(): Observable<xResponse> {
return this.http.get<xResponse>('/services/****/user/j**/******');
}
other Service
export interface yResponse {
rows: Array<string> ,
}
@Injectable({
providedIn: 'root'
})
export class yService {
constructor(private http: HttpClient) {}
getyInfo(): Observable<yResponse> {
return this.http.get<yResponse>('/services/c***/user/j****/*****');
}
}