gpt4 book ai didi

angular - angularfire2订阅中的无限循环

转载 作者:太空狗 更新时间:2023-10-29 18:20:26 25 4
gpt4 key购买 nike

我正在获取数据并将数据添加到订阅中的同一节点。如何避免死循环?

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: ''};
};

关于angular - angularfire2订阅中的无限循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43120634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com