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: ''};
};
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: ''};
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With