我想使用返回可观察对象的方法来转换和替换数组中的所有单词。我使用基于this answer的绑定来传递正确的值。等待一组可观察的订阅函数完成
当所有订阅完成后,我想调用另一个函数task2()
。我怎样才能实现这个?
for(let word in this.words){
var i = Object.keys(this.words).indexOf(word);
this.convertor.get(this.words[i].value).subscribe(function (i, result) {
this.words[i].value = result;
}.bind(this, i));
}
//task2() <--------- when all subscribe functions finished
的可能的复制(http://stackoverflow.com/questions/35608025/promise-all-behavior -with-rxjs-observables) –