如何使用angularfire2检查子列表是否存在于firebase列表中

时间:2018-02-10 07:33:23

标签: angular typescript firebase firebase-realtime-database angularfire2

我需要使用angularfire2检查是否存在firebase列表。

这是我的父母名单:

enter image description here

我需要检查孩子消息是否存在。

这是我的代码:

  checkChild(){
    let usersRef = this.db.list(`/Users/${this.authData.afAuth.auth.currentUser.uid}/`);
  }

我尝试输入一些方法,例如userRef.child('Messages')userReflistChild('Messages'),但我收到的错误是最后一种方法不存在。

我需要避免使用subscribe方法,我可以使用map方法解决,但我正在寻找新方法和firebase最佳实践。

1 个答案:

答案 0 :(得分:0)

我没有看过AngularFire2,但是使用FireBase Real-Time数据库文档,你可以使用这里描述的“hasChild()”方法。

Firebase Documentation, Datasnapshot, hasChild

相关问题