Angularfire2 和使用数据扇出更新不同的对象
Angularfire2 and updating different objects using data fan-out
我需要更新数据库中的对象,所以我这样做了:
const items = af.database.list('/items');
items.update('key-of-some-data1', { size: newSize1 });
items.update('key-of-some-data2', { size: newSize2 });
这很有用,但我想用 "data fan-out" 更新项目,如下所述:
https://firebase.google.com/docs/database/web/read-and-write
https://firebase.googleblog.com/2015/10/client-side-fan-out-for-data-consistency_73.html
我也是:
var updates = {};
updates['key-od-some-data1']= { size: newSize1 };
updates['key-od-some-data2']= { size: newSize2 };
items.update(updates);
不幸的是我得到了这个错误:
zone.js:140 Uncaught Error: Error in ./AppComponent class AppComponent - inline template:30:2 caused by: Method requires a key, snapshot, reference, or unwrapped snapshot. Got: object
是否可以使用 angularfire2 将数据扇出更新到数据库?数据扇出是否仅适用于相同的对象键或其他东西?
替换:
const items = af.database.list('/items');
与:
const items = af.database.object('/items');
我需要更新数据库中的对象,所以我这样做了:
const items = af.database.list('/items');
items.update('key-of-some-data1', { size: newSize1 });
items.update('key-of-some-data2', { size: newSize2 });
这很有用,但我想用 "data fan-out" 更新项目,如下所述: https://firebase.google.com/docs/database/web/read-and-write https://firebase.googleblog.com/2015/10/client-side-fan-out-for-data-consistency_73.html
我也是:
var updates = {};
updates['key-od-some-data1']= { size: newSize1 };
updates['key-od-some-data2']= { size: newSize2 };
items.update(updates);
不幸的是我得到了这个错误:
zone.js:140 Uncaught Error: Error in ./AppComponent class AppComponent - inline template:30:2 caused by: Method requires a key, snapshot, reference, or unwrapped snapshot. Got: object
是否可以使用 angularfire2 将数据扇出更新到数据库?数据扇出是否仅适用于相同的对象键或其他东西?
替换:
const items = af.database.list('/items');
与:
const items = af.database.object('/items');