如何访问Folderlistfatima> listOfnotes>并经历0和1和2(我想检查每个结构的标题)

时间:2019-05-07 14:25:38

标签: typescript firebase ionic-framework

我认为问题出在这里,我想我以错误的方式访问它。

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.')});
      }    

}

0 个答案:

没有答案