As a newcomer to angular and rxjs, I am seeking guidance on how to properly retrieve data from forkJoin using a map function.
ngOnInit(): void {
this.serviceData.currentService.subscribe(service =>
this.serviceFam.getAllFamilles().pipe(
switchMap(familles =>
forkJoin(
familles.map(f => forkJoin(
this.serviceAffecter.getAffecterServiceFamille(service, f.nom),
this.serviceOpe.getOperationsServiceFamille(service, f.nom)
).pipe(
map(([listAffecter, listeOperations]) => [f, listAffecter, listeOperations])
)
)
)
)
).pipe(switchMap((data: [Famille, Affecter, Operation][]) => {
return forkJoin(data.map((f, a, o) => {
//My goal here is to effectively extract and utilize the retrieved data
}));
}))
);
this.serviceData.changeAffaire(4);
}