Loading data during Splash screen


#1

Hi guys,

I tried to load some data in my app.component.ts before entering the app so i can redirect the user in the right page.
However i noticed that the network call is never executed. And that it got stuck here since my rootPage is not defined until I got the response.
This is the code i have in my app.component.ts :

rootPage:any;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, keyboard : Keyboard, authentificationService : AuthentificationService) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      authentificationService.checkAuth().subscribe(isAuthenticated => {        
        if (isAuthenticated){
          this.rootPage = BookingList;
        }else{
          this.rootPage = LoginPage;
        }
      }, err =>{
        console.log(err);
      });
      //here we will check first if the user is already authentified

      splashScreen.hide();

    });
  }

Actually I don’t know what is the best practice here. Should i create simple page that would be my splash screen ?