My ionic 5 (Angular) project uses Google firebase database.
This is an example code I used to read data from firebase database. I just want to read the data only once. As valueChanges()
is a observable, I guess I have to unsubscribe the subscription every time when use it.
constructor(db: AngularFireDatabase) {
this.tempsub = db.list('items').valueChanges().subscribe(data=>{...});
this.tempsub.unsubscribe()
}
Do I have to unsubscribe it in my use case? Is there a better solution to read the data from firebase database only once?