3
所以我有下面的代碼獲取FirebaseObjectObservable。但路徑是動態的,因爲它可能還沒有。所以如果路徑不在那裏,我想創建這條路徑。但如果它在那裏,我想更新/修補數據。我如何知道FirebaseObjectObservable爲空?
this.userLocationDetail = this.af.database.object('/userProfile/' + uid + '/bbwList/' + afLocationId);
if (this.userLocationDetail) {
console.log('Data is found');
} else {
console.log('Data not found');
}
問題是如果(this.userLocationDetail)將始終爲真。我怎樣才能看到可觀察的並確定它是空的?
謝謝!任何示例以及可觀察的方法? –
我添加了一個可觀察的代碼 –