How can I set up a login page that leads to the tabbed view in Ionic 2?


Currenty, in my app.htmlfile, I have:

   <ion-tab [root]="tab1Root" tabTitle="Tab1" tabIcon="time"></ion-tab>
   <ion-tab [root]="tab2Root" tabTitle="Tab2" tabIcon="paper"></ion-tab>
   <ion-tab [root]="tab3Root" tabTitle="Tab3" tabIcon="more"></ion-tab>

and in my app.js file, after doing the proper imports of these pages, I have:

this.tab1Root = Page1;
this.tab2Root = Page2;
this.tab3Root = Page3;

I want the application to open with a login page, and then from there progress to this tabbed view. I’m not sure how to logically set this up in the context of app.html and app.js


In your app constructor you can do:

    this.rootPage = isLoggedIn ? TabPage : LoginPage;

in your app.html put

   <ion-nav id="nav" [root]="rootPage" #content swipe-back-enabled="false"></ion-nav>