0

So I have firebase database and mostly all screens is connected to firebase database. I have a page where I need to delete/add data from firebase database. The problem now is when I delete/add something it open the pages who I visited and connected to the firebase database on its own. its like a wild page jumping each pages I visited.

Does anyone experience this?? Please help!!!

Ionic Framework: ^3.6.0 Ionic App Scripts: 2.1.3 Angular Core: 4.1.2 Angular Compiler CLI: 4.1.2 Node: 6.9.4

KENdi
  • 7,576
  • 2
  • 16
  • 31
  • 1
    It is best to show some code so people can try to reproduce your problem, or at least review the code to see if there are obvious issues. – Steven Scott Aug 02 '17 at 13:48

1 Answers1

1

This is possibly due to the callback feature of Firebase; every time theres a deletion/ updation, there's a callback your current page receives, which makes it rerun your code. Which again triggers a callback and this goes on forever.

To solve this, you need to ensure that the Firebase reference is made just once as shown below:

public list: firebase.database.Reference = firebase.database().ref('');
this.list.once("value").then( itemSnapshot=> {
...
})