看似简单的任务,应该已经有很多答案了,但我找不到能解决我问题的答案。
我有一个Observable,它发出一个对象。该对象的属性之一是另一个Observable。我希望在第一个Observable发出对象时,将其替换为第二个Observable的值。
const outer = of({
someProperty: 'This is a simple value',
inner: of('This is a value from the inner Observable')
});
我想要以下内容:
// output: { someProperty: 'This is a simple value', inner: 'This is a value from the inner Observable' }
const subscribe = outer.subscribe(console.log);
我怎么能达到这个结果? RxJS运算符的某种组合应该可以解决问题,但我只是找不到合适的解决方案。