Skip to content

Instantly share code, notes, and snippets.

@agustinhaller
Created January 21, 2019 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustinhaller/c84a0cb909a22d027702f8f6cc625beb to your computer and use it in GitHub Desktop.
Save agustinhaller/c84a0cb909a22d027702f8f6cc625beb to your computer and use it in GitHub Desktop.
angular 7 forkJoin
// See: https://www.learnrxjs.io/operators/combination/forkjoin.html
// Added take(1) bc of this behaviour: https://github.com/angular/angularfire2/issues/617#issuecomment-255513958
forkJoin(
this.firebaseService.getUserEventsForDevice(selectedDevice.key, filterCriteria).pipe(take(1)),
this.firebaseService.getEventsFromDevice(selectedDevice.key, filterCriteria).pipe(take(1))
)
.subscribe(
([userEvents, deviceEvents]) => {
console.log('userEvents', userEvents);
console.log('deviceEvents', deviceEvents);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment