EXIT ion-tabs


#1

Hi !

I try to exit my ion-tabs when I logout but I can’t. I tried let nav = this.app.getRootNav();
nav.push(AccueilPage); but that doesn’t work. Have you an idea please ?


#2

Use setRoot instead of push

Many examples in this forum


#3

Yes ! I read many articles i work since 3 hours for this problem :’( I tried setRoot and many other things but that doesn’t work :frowning:


#4

With setRoot that’s work only the first time…


#5

So basicly you just want to hide the tabs am I right ?


#6

Yes ! I have a tabs where I have a logout button So I just want to remove the token and go on my first page without tabs. I found many issues in the forum but no solution for my app…


#7

To simply hide your tabs use this code

    let tabs = document.querySelectorAll('.show-tabbar');
    if (tabs !== null) {
      Object.keys(tabs).map((key) => {
        tabs[key].style.display = 'none';
      });
    }

To show it again change none to flex.


How to hide tabs when keyboard is shown?
#8

Thank for the solution but is it a salution with setRoot or push because with your solution, my stack keep tabs ?


#9

As far as I know, if you start initilizing your application with Tabs it will stay there and the only possible thing todo is to simply set it to an empty state -> ‘none’.

If someone knows how to completly unload them I would be very interested to hear it.


#10

But I don’t start with tabs page but with my ConnexionPage So it’s weird but thanks.


#11

Then how do you even start displaying tabs if you don’t start with Tabspage ?


#12

First, I have my Log Page and When I’m connected, I do setRoot(TabsPage) and the problem is when I logout to go again on Log Page…


#13

I might found what you need!

Use this command removeView(viewController)

As example:
this.navCtrl.removeView(Tabbar);

This will remove the Tabbar from the navStack like you wanted!



#14

Plse share more code

Html/ts of the root tab definition and the ts which handles the logout

Imho the solution still is a setRoot


#15

This does it for me


#16

Thanks but how Can I access to Tabbar please ?


#17

Also how you set it as rootpage.


#18

thanks that work ! But I have just one question, what is the difference between this.app.getRootNav().setRoot() and this.navCtrl.setRoot() ?

Thanks again !


#19

Hi, you r welcome

The navigation context: top root of the app or the embedded tab view (this.navctrl assumingly refers to)

Plse mark solution as solution, if u like it!

Rgdz
Tom


#20

And in practical, what’s the difference ?