假设我有一系列可观察量,这些可观察量会发出一些我想要在最后构建对象的值。例如:
this.myService.myMethod()
.map(items => items.map(items => item.id))
// Save id somehow
.map(id => this.myService.anotherMethod(id)
// Save another property here
.filter(data => data.length > 0)
// At this point, I'd like to have the above 2 variables as well as
// access to another property based on what is returned from the previous
// stream
this.myObject = this.myObject.concat({
var1,
var2,
var3
})
)
我想知道我是否可以使用combineLatest
或merge
或withLatestFrom
来保存这些变量?
答案 0 :(得分:1)