I'm storing data in a Firebase realtime database and I'm trying to get the stored data and it seems I'm not getting it correctly - I need any assistance.
auth.service.ts
:
get_Data() {
return firebase.database().ref('transfer/').on('value', (snapshot) => {
this.transfer = snapshot.val();
console.log('snapshot here', this.transfer);
})
}
returns
app.component.ts
:
dataList(){
this.list = this.authService.get_Data();
console.log('got you', this.list)
}
returning undefined
...
useEffect(() => { db().ref('/').on('value', handleReservas); db().ref('/').on('value', handleData) }, [userID]);
kindly elaborate a bit comparing to mine code