Issue
So my code is:
combineLatest([obs1, obs2]).subscribe((x => {
console.log(x)
})
The log statement should be fired when EITHER observable emits. However, there is a gotcha as described in the docs:
combineLatest will not emit an initial value until each observable emits at least one value
I need it to emit even if one of the original observables has never emitted. How would I do this? many thx
Solution
typical use startWith with each observable
combineLatest([
obs1.pipe(startWith(null)),
obs2.pipe(startWith(null)]
).subscribe((x => {
console.log(x)
})
Answered By - Eliseo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.