Firebase:使用AngularFire2更新列表绑定中的项

Firebase:使用AngularFire2更新列表绑定中的项,firebase,angularfire2,Firebase,Angularfire2,根据文档,当您不想更新列表中的项目时,可以执行以下操作: const items = af.database.list('/items'); // to get a key, check the Example app below items.update('key-of-some-data', { size: newSize }); 但是,是否可以更新列表中的项目,而不必像这样为对象指定key:值 items.update('key-of-some-data', item); 在这种情况下

根据文档,当您不想更新列表中的项目时,可以执行以下操作:

const items = af.database.list('/items');
// to get a key, check the Example app below
items.update('key-of-some-data', { size: newSize });
但是,是否可以更新列表中的项目,而不必像这样为对象指定key:值

items.update('key-of-some-data', item);
在这种情况下,可以这样做:

<li ng-repeat="item in list">
<input type="text" ng-model="item.title" ng-change="list.$save(item)" />
</li>

  • 感谢您花时间阅读此问题:)

    更新的实现如下所示:

    update(项:FirebaseOperation,值:Object):firebase.Promise{
    返回此。\u检查操作案例(项目{
    stringCase:()=>此.$ref.ref.child(项).更新(值),
    firebaseCase:()=>(项)。更新(值),
    快照案例:()=>(项).ref.update(值),
    unwrappedSnapshotCase:()=>this.$ref.ref.child(。但是,对于这种特定的内容,您应该创建一个