How can I modify this line to return a value in the subscribe function instead of an observable?
let test = undefined;
of(test, this.myService.whatever(var1, var2))
.pipe(
first(n=>!!n)
).subscribe(result=>console.log(result)); // returns Observable, should return value.
The myservice.whatever method returns an observable. I want it to resolve inside the pipe. Is there a way to achieve something like this:
let test = undefined;
of(test, this.myService.whatever(var1, var2))
.pipe(
first(n=>!!n),
getValueFromObserver() // if it's an observer get the value
).subscribe(result=>console.log(result));
Is this feasible? I am attempting to verify within the observer's sequence if a local variable holds a value, and if not, fetch the value from the backend. This is necessary as the actual code is quite intricate, and the result of this observable will be combined with other observers using forkJoin.