Create a complete app


#1

Hi, im actually working in a new project that needs to have a login page before entering the app. My app has a sidemenu and tabs, and there is the problem, i created the login page but when i set the rootpage as tabs, my loginpage disappears. And i don’t know how to make the first page be the loginpage and after login in the home with the tabs. Please help :frowning:


#2

hello,

maybe I understood it wrong.

In app.component.ts you have something like
rootPage: any = ‘HomePage’;
or
rootPage: any = HomePage;

First is lazy loaded as string, seconded is eager loaded as object. Depending how you will load your page you must decare it in app.module.ts or componets.module.ts or whatever.module.ts.

Any page you will set rootpage: any = whateverPage in app.component.ts should start up.

If you want to set later an other page as root, then you can use NavController for that.
this.nav.setRoot(whateverpage);

The Navcontroller must injected in your page where you want use it. Standard creating a page with cli should do that for you automatically (see constructor of that page)

Best regards, anna-liebt


#3

See:


#4

rootPage:any = TabsPage;

that’s my rootpage, and i don’t know how to make tabsPage appear after logging in. Maybe with an if and else as robinyo says, but i dont understand this:
authService
afAuth
authState

What are those? Your services of conection? Im new in Ionic … :frowning:


#5

First change the root page to Login page, then on login button i.e this.navCtrl.push(TabsPage) add another line below:
navCtrl.setRoot(TabsPage);
It will set the root page as tabspage but only after navigating from login page.