且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过某些键值 Angularfire2 remove()

更新时间:2023-10-11 22:48:34

这是一种方式:

const commentList = this.af.database.list('/eComments', {
      preserveSnapshot: true,
      query: {
        orderByChild: 'sid',
        equalTo: sid
      }
    });
commentList.subscribe(snapshots=>{
    snapshots.forEach(snapshot => {
      snapshot.ref.remove();
    });
})

我不是 AngularFire2 专家,所以可能有更简单/更惯用的方法.

I am not an AngularFire2 expert, so there might be easier/more idiomatic ways.