I would like to convert and replace all words in an array using a an object's method which returns an observable. I'm using bind based on this answer to pass the correct value.
When all subscriptions finish, I would like to call another function called task2()
. How can I implement this?
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