angularfire2订阅中的无限循环
Endless loop in angularfire2 subscription
我正在获取数据并将数据添加到订阅中的同一节点。如何避免死循环?
this.af.database.list('objects/').subscribe(x=>{ / the subscription is only needed once
this.af.database.list('objects/').push({newobject: ''};
};
如果我错了,请开枪,但我相信你可以使用 first()
方法:
this.af.database.list('objects/').first().subscribe(x=>{
this.af.database.list('objects/').push({newobject: ''};
};
我正在获取数据并将数据添加到订阅中的同一节点。如何避免死循环?
this.af.database.list('objects/').subscribe(x=>{ / the subscription is only needed once
this.af.database.list('objects/').push({newobject: ''};
};
如果我错了,请开枪,但我相信你可以使用 first()
方法:
this.af.database.list('objects/').first().subscribe(x=>{
this.af.database.list('objects/').push({newobject: ''};
};