我正在尝试从 Firebase 检索对象列表。 这是数据库的结构:
我已经试过了:
this.db.object('/users/'+this.userId+'/movies-favourited/').snapshotChanges().subscribe(data=>{
this.favouriteList = data.payload.val()
});
我从这个查询中得到了空值。我错过了什么??
附言:这就是我在控制台中得到的 data.payload:
Object { _database: {…}, _delegate: {…} }
_database: Object { _delegate: {…}, app: {…}, INTERNAL: {…} }
INTERNAL: Object { delete: delete()
}
_delegate: Object { _repoInternal: {…}, type: "database", _instanceStarted: true, … }
app: Object { isDeleted_: false, name_: "[DEFAULT]", automaticDataCollectionEnabled_: false, … }
<prototype>: Object { useEmulator: useEmulator(host, port, options), ref: ref(path), refFromURL: refFromURL(url)
, … }
_delegate: Object { _node: {…}, ref: {…}, _index: {} }
_index: Object { }
_node: Object { children_: {…}, priorityNode_: null, indexMap_: {…}, … }
ref: Object { _repo: {…}, _path: {…}, _orderByCalled: false, … }
<prototype>: Object { child: child(path), exists: exists(), exportVal: exportVal()
, … }
<prototype>: Object { val: val(), exportVal: exportVal(), toJSON: toJSON(), … }