I\'m new to observables in angular. I have a problem wanting to return a value inside a subscribe method. I have
the following method (getFirebaseData(idForm:string):o
Observable runs when you subscribe to it and what return from subscription is always a subscription object like setInterval. first sample: because this is a async call, second console.log won't wait for subscribe to finish before it executes.
getTotalQuestions(idForm: string) {
let totalQuestions: number;
return this.getFirebaseData(idForm + "/Metadatos").pipe(
map(items =>
items.map(item => {
totalQuestions = item.Total;
console.log(totalQuestions);
});
));
}
getTotalQuestions('231').subscribe(console.log)