Ionic Tabs App with Login Screen

Thanks for that. How do I define that callback paramater in my LoginPage constructor?

Actually I was passing callback to .push() and not Modal.

Not sure about modal and now have no chance to try but Modal has overlay:

And OverlayController is raising even instance.onPageWillLeave() :

I would try to hook in there.

May be something like <ion-overlay (onPageLeave)="handle()">

I think it’s a good candidate to request a feature to add an easy way to handle close event from a Modal at

Thanks - that’s all a bit beyond me at the moment I think! I tried but couldn’t get anything to work.

I hope there’s a straightforward way of doing this.

@richardshergold, I myself am implementing a login as modal on startup. If I get any success I’ll let you know.

1 Like

thank you, that would be really helpful!

@richardshergold see

1 Like

I’m actullay stuck with the same problem, i.e. trying to go back to the initial screen after signin out of the application, which I don’t want to do in a modal since this would be the first screen when the user opens the app. Is there any way to do this? any way to use popToRoot() or something similar that will really make you go to the root without the tabs?

@mhartington, can we have some solution here? The flow goes like this.

LoginPage -> Tabs (each tab with root property) -> (Profile page as a tab) ->(click logout)

Now it should go back to Login with empty Navigation stack!.

Note : When we have root property set to the TAB, it creates its own navigation stack.

Yep, that should be the expect results.

I believe there is an open issue for something like already, you might want to check

It’s part of bigger structural feature that we have on our roadmap

1 Like

I just set the loginpage as root when logging out.
When logging in again, I set the tabspage as root.
Oh, and I used *ngIf to display the side menu only if the user is logged in. It works fine, theres just a little bummer with it: Currently, the side menu button is visible in the login page, but does nothing.

Anything wrong with this approach?

ok I just moved away from that, because there were some strange artifacts regarding pageflow. I moved on to using a Modal to log in, works kinda fine


Anyone found a solution that works for the moment?

I try to opening the Login Screen as modal, once the ‘tabs’ page is loaded (onPageDidEnter event), but:

  1. When I dismiss() the Login page it re-appears once more, and I have to dismiss it again. (So I have to dismiss login page twice)

  2. After the Login dismiss, the tabs do not work on Android (browser with “ionic serve --lab” command, and Genymotion emulator). The iOS emulation on browser (on “ionic serve --lab” command) do works fine (I had not the chance to test it on physical iOS).

So my question: which is currently the best method for invoking a Login/Signup screen on ‘tabs’?

Thank you

you have to set the nav of the “rootNav” and not the nav.


This article helped


Many thanks! It worked

1 Like

With ionic-angular 2.0.0-beta.11, the root nav property this.nav.rootNav soes not exist.
The workaround I did was, In my tab component constructor, injected App and uses it to get the root nav as follows:

  templateUrl: 'build/pages/requests/a.html',
export class aTab {

  constructor(private navCtrl: NavController, private app: App) {

  goToLoginPage() {, {}, {animate: true, direction: 'forward'});


This helps come out of the tabs nav and create a new nav stack.


rootPage = LoginPage;

in app.component.ts file
after logging in successful set root to TabPage

For 2.0.0-rc4:

let nav =; nav.setRoot(LoginPage);