Reputation: 35693
I am getting data and add data to the same node within an subscription. How can I avoid the endless loop?
this.af.database.list('objects/').subscribe(x=>{ / the subscription is only needed once
this.af.database.list('objects/').push({newobject: ''};
};
Upvotes: 3
Views: 274
Reputation: 71891
Shoot me if I'm wrong, or don't, but I believe you can use the first()
method:
this.af.database.list('objects/').first().subscribe(x=>{
this.af.database.list('objects/').push({newobject: ''};
};
Upvotes: 4