I dont know how to extract value from Observable to be returned by function in which Observable is present. I need just a value from it to be returned, nothing else.
Current version which works
function getValueFromObservable() {
this.store.subscribe(
(data:any) => {
console.log(data)
}
)
}
getValueFromObservable()
I need this to work, function to return value, and then:
function getValueFromObservable() {
this.store.subscribe(
(data:any) => {
return data
}
)
}
console.log(getValueFromObservable())
What am I doing wrong here?
subscribe
– Can Nguyen