I have two service, and I need to get one observable from each service. I have search on internet and found one solution, which is here : Is it good way to call subscribe inside subscribe? But it doesn't work for me. The two observable works good when they are called alone.
export class EditVarianteComponent implements OnInit {
public currentVariante: Variante;
public url: string;
public value$: any;
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
private varService: VarianteService,
private famService: FamillesService
) {}
ngOnInit() {
this.url = atob(this.activatedRoute.snapshot.params.id);
//Here, I get the resource, and I want the result of this resource to be the parameter of my second observable
this.varService.getResource(this.url)
.pipe(
flatMap((res1) => this.famService.getFamilleById(res1.id_famille))
)
.subscribe((res3) => {
console.log(res3);
});
}