AngularFire $remove item from Array using a variable in Firebase reference does not work

后端 未结 2 1056
慢半拍i
慢半拍i 2021-01-23 07:18

I\'ve been struggling with the following problem:

I\'m trying to delete a \'Post\' item from a Firebase Array with the $remove AngularFire method which I have implemente

2条回答
  •  感情败类
    2021-01-23 07:50

    The easiest way for me was to use this:

    var ref= new Firebase('https://Yourapp.firebaseio.com/YourObjectName');
    ref.child(postId).remove(function(error){
        if (error) {
        console.log("Error:", error);
      } else {
        console.log("Removed successfully!");
      }
    });
    

提交回复
热议问题