In your AppComponent.ts:
import { Component } from '@angular/core';
import { Config, Nav, Platform } from 'ionic-angular';
import { AuthService, ServiceWorkerService, LoggerService } from '@core/index';
@Component({
templateUrl: 'app.component.html'
})
export class AppComponent {
// [root]="rootPage"
public rootPage: any = 'LoadingPage';
// [class]="theme"
public theme: String = 'orange-theme';
constructor(public config: Config,
public platform: Platform,
private authService: AuthService,
private swService: ServiceWorkerService,
private logger: LoggerService) {
this.initialiseApp();
}
private initialiseApp() {
this.platform.ready().then(() => {
this.swService.run();
});
this.authService.afAuth.authState.subscribe(user => {
if (user) {
this.rootPage = 'TabsPage';
} else {
this.rootPage = 'SignInPage';
}
}, () => {
this.rootPage = 'SignInPage';
}
);
}
}
app.component.html:
<ion-nav [root]="rootPage" [class]="theme"></ion-nav>