Closed slim-hmidi closed 6 years ago
I'm trying to get data from a database using two observables:
const roomData$ = Observable.create((observer) => { estab .query() .where('estab.type', 'like', 'rooms') .then((rooms) => { observer.next(rooms); observer.complete(); }) .catch((error) => { observer.error(error); }); }) const hotelData$ = Observable.create((observer) => { estab .query() .where('estab.type', 'like', 'hotels') .then((rooms) => { observer.next(rooms); observer.complete(); }) .catch((error) => { observer.error(error); }); }) hotelContentData$ = Observable.merge(roomData$, hotelData$)
Is it possible for many observables to read from a database simulatenously? Because I got only a data from one of them not both.
I solved my problem with combineLatest():
combineLatest()
hotelContentData$ = Observable.combineLatest(roomData$, hotelData$)
I'm trying to get data from a database using two observables:
Is it possible for many observables to read from a database simulatenously? Because I got only a data from one of them not both.