我认为问题出在这里,我想我以错误的方式访问它。
firebase.database()。ref('/ FolderList'+ this.username +'/ listOfNotes /')。once('value',(快照)=>
这是我的代码:
let exist=false;
firebase.database().ref('/FolderList'+this.username+'/listOfNotes/').once('value', (snapshot) => {
snapshot.forEach(snap => {
if (snap.val().title==newObject.title){
exist=true;
}
return false;});
});
if (exist){
this.presentToast('Note already exists in folder.');
}
else {
this.afdb.list('/FolderList'+this.username+'/').update(folderKey,newObject).then((response)=>{this.presentToast('Added to folder.')});
}
}