Why does AngularFireDatabase switch to another view when saving information?


#1

I’ve recently run into a problem using angular fire in IONIC, whenever I store info in the database, the current view is switched to the homepage by default. For example:

    this.afDatabase.object(`perfil/${this.idUsuario}/disponible`).set(true);

If I use that line, the item is stored but the view from the user profile is gone, and the app moves to the homepage.

My quick solution is:

  this.afDatabase.object(`perfil/${this.idUsuario}/disponible`).set(true).then(()=>this.navCtrl.push(PerfilPage));

But I don’t want to reload the current view again, is there a better way to do it?


#2

Hi

There must be something else going in your code beyond what you have shared.

Plse check your usage of navCtrl in other places and its dependency on values, also in the templates as Angular may trigger something due to value change

Rgdz

Tom