Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角射推送功能_Javascript_Firebase_Angularfire2 - Fatal编程技术网

Javascript 角射推送功能

Javascript 角射推送功能,javascript,firebase,angularfire2,Javascript,Firebase,Angularfire2,我正在使用angularfire,如下所示: this.afDB.list('/items/' + this.itemID).push({displayName: item.name}); 然后结构看起来像这样,itemID是qoieke items: - qoieke: - Leow9dnfwoierjhwelo - displayName: "Something" 我不明白的是如何避免将“

我正在使用angularfire,如下所示:

 this.afDB.list('/items/' + this.itemID).push({displayName: item.name}); 
然后结构看起来像这样,
itemID
qoieke

items:
    - qoieke:
            - Leow9dnfwoierjhwelo
                                - displayName: "Something"
我不明白的是如何避免将
“Leow9dnfwoierjhwelo”
作为自动生成的id

因此,我希望有如下结构:

items:
    - qoieke:
           - displayName: "Something"

谢谢

调用
push
会生成所谓的推送ID。若不生成该ID,请不要调用push。而是调用
set()
(用传入的内容替换该位置的当前值)或
update()
(仅修改传入的属性)

在您的情况下,
update()
似乎可以满足您的需要:

this.afDB.list('/items/' + this.itemID).update({displayName: item.name});