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


#1

Currenty, in my app.htmlfile, I have:

<ion-tabs>
   <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>
</ion-tabs>

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


#2

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>

#3