Error: Reference.child failed: First argument was an invalid path

后端 未结 2 706
南笙
南笙 2021-01-24 23:45

I have this small app with Firebase and i\'m implementing CRUD operations. The issue comes when I have to delete a post. I get this error: Error: Reference.child failed: F

2条回答
  •  生来不讨喜
    2021-01-25 00:22

    @Frank van Puffelen snapshotChances() was the solution. This methods returns the id from the node to delete in firebase. So, in the service, I get the reviews like this:

    getReviews() {
        return this.db.list('/reviews').snapshotChanges();
      }
    

    And the HTML should be

     
    

    And back in the service, the delete method:

    deleteReview(id: any) {
        console.log(id)
        this.db.object('reviews/' + id).remove();
      }
    

提交回复
热议问题