有没有办法通过链接将Observerable映射到另一个?我现在正在这样做:
const myObserverable = fnThatReturnsObserverable();
return anotherFunctionThatReturnsObserverable(myObserverable);
有没有办法以链式方式做到这一点?
return fnThatReturnsObserverable().someOperator(anotherFunctionThatReturnsObserverable)
答案 0 :(得分:2)
fnThatReturnsObserverable()
.let(obs => anotherFunctionThatReturnsObserverable(obs));
有关它的更多信息here。
答案 1 :(得分:-1)
您还可以使用of
和mergeMap(or concatMap)
Observable.of(fnThatReturnsObserverable())
.mergeMap(ob => anotherFunctionThatReturnsObserverable(obs));