I can’t use a variable to hold the name of my list on firebase.
After I push some data the variable becomes undefined in firebase.
$this.UserID is meant to hold the UID but it can't be read.
My code:
private referenceListRef;
UserID: string;
constructor(private http: Http,
private db: AngularFireDatabase,
private ofAuth: AngularFireAuth,
public storage: Storage
) {
this.ofAuth.authState.take(1).subscribe(data => {
this.UserID = data.uid;
console.log(`user id : ${this.UserID}`);
})
this.referenceListRef = this.db.list(`${this.UserID}`);
}