I'm doing an application on Angular 6, I created a class, how can I subscribe an array of objects of my class on a firebase realtime db? I'd like to modify these objects without any need to update array. Is it possible? How can I transform the db list into an array of objects with my class on the subscribe? Thank you
This is the class now, I will add functions
export class Bet {
private name: string;
private date: Date;
private bet: number;
private payout: number;
private won: boolean;
private type: string;
}
This is the function I tried to use to subscribe object list to db
this.afdb.list<Bet>('/Users/'+ uid + '/bets').valueChanges().subscribe( dbbets
=> {
this.bets = dbbets;
});
I'd like to add a new object of class Bet to this.bets and update automatically the db, is possibile with subscribe?
Comments
Post a Comment