Tabs do not disappear when using setRoot


#1

Hello Hello,

I have a question for you :slight_smile:
So basically I understood how to hide the tabs on subpages when I am using push and everything is working fine.

I implemented a logout service to clean my pouchDB, disconnect from my server etc etc. When everything is ok I am supposed to redirect to the connection page.

However when I am trying to use the setRoot on my navcontroller I can see that the tabs still appears.

When I relaunch my app I am well redirected to the connection page as my credential are no more stored locally and the tabs bar do not appears.

The problem is only when I am deconnecting. And when I am reconnecting I have two tabs (one on the other) which is pretty uggly :smiley:
To finish when I click on the tab from connection page I can display my tabs content but I am getting erros because I cannot reach my server as I am no more connected. However when I connect if I click on this tabs it disappear.

Is there a way to remove this tabs??

Thanks a lot Ionic friends

Best regards

Geoffrey


#2

@speedflyer Unfortunately (I think) the NavController setRoot method will set the page under the innermost ion-nav (expected) or ion-tab (unexpected IMO). To handle that I created a service where I set the NavController related to my ion-nav and use push, pop and setRoot in it. Something similar to what I exposed in this post:


#3

Thanks a lot I will try :slight_smile: and I will let you know


#4

Funny, we had that issue too last week.

You will find your solution in following post, you have to set root to the root of the navigation


#5

Thanks a lot. it is working!!!

Like we say in french:

Et pour reedrichard hip hip hip!!!
HOURRAAAA!

:wink:

I think Ionic team should maybe put this in the global spec :slight_smile:

In any case thanks!


#6

Pas de problème, content d’avoir pu t’aider :wink:


#7

i solved this problem use follow code:
constructor(private app: App) {}
logout(){
this.app.getRootNav().setRoot(Login);
}


#8

Thx!! It’s works!! I’m using with 2 tabs in a same app.


#9

thx, work :slight_smile:


#10

Try do add this directive to the button or nav you are click

menuClose

Example

<button menuClose>My Profile</button>

#11

works, but only in dev mode (ios). prod… doesnt do any!