6
votes

I have an Observable (lets call it myob$) which emits values like this:

----- null ----- 1 ----------- 5 ---->

If i do:

myob$.subscribe(x => console.log(x))

the output is ----- null ----- 1 ----------- 5 ---->

Can I add a pipe so it does not emit until the value from myob$ is not null?

something like:

myob$.pipe(x => ignoreEverytingUntilXIsNotNull).subscribe(x => console.log(x))

So that the output is --------------- 1 ----------- 5 ---->

Thanks in advance

1

1 Answers

4
votes

bah I'm thick, I think you just need to do:

myob$.filter(x => !!x).subscribe(x => console.log(x))

assuming no 0's are being emitted :)