Ionic going to rootPage after 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 rootpageby default. For example:

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

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

I tried using a provider, but still happens the same thing, why is it happening? How could i fix it?

Please help me, it’s been 1 week and haven’t found a solution.


#2

Search your code for a line like this:

this.navCtr.setRoot('HomePage');

The line of code you post here does not change the root page.


#3

That line of code is in another view though. Here is the repo maybe you could help me by looking at the source code better.


#4

I think the problem is in you signIn function.

You subscribe to perfil.

When you update this node the function in the subscription set the rootPage to HomePage


#5

Ok, I see so how should I log in/save data then?


#6

In your app.component you have comment out the authentication handler. I would use this to handle the auth state.

To save date the line of code you postet shoud be enough.