I don't understand why I can do
ForkJoin(service.Obs1(), service.Obs2()).subscribe
But if I refactor my code such that I add a method to my service class that returns ForkJoin(this.Obs1(), this.Obs2())
, such as for example
updateWhatever(): Observable<[string, string]> {
return forkJoin([
this.Obs1(),
this.Obs(2)
]);}
Then if I do service.updateWhatever().subscribe(res => //handle res[].
, it throws the error
You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable
Why won't this work? One should be able to refactor in such a fashion. What am I missing? I realize it's returning an array of observables, but why should the function call not handle this?
Maybe my question is, how does one handle a method that returns a forkJoin ?