Cześć, mam w angularze następującą funkcję:
refresh(){
var tab1 = [];
var tab2 = [];
var tab3 = [];
this.multiselectedMeters.forEach(item =>
{
forkJoin
(
this.influxService.getManagerSummary(item.id),
this.influxService.getRaw('cost', item.systemName, from, to),
this.influxService.getRaw('ea_diff', item.systemName, from, to)
)
.subscribe(([managerSummary, graph, graphCost]) => {
tab1.push(managerSummary);
tab2.push(graph);
tab3.push(graphCost);
})
});
console.log(tab2.length)
}
Mój problem polega na tym, że w linijce "console.log(tab2.length)" otrzymuję wartość 0. Najprawdopodobniej spowodowane jest to tym, że linijka ta wykonuje się szybciej niż forkJoin otrzyma wyniki. Co musiałbym zmienić, żeby funkcja działała jak należy?