I have redirected my app from app.component.ts
by setting rootpage
as follow
rootPage:any=HomePage;
Later when I implemented login functionality I decided to redirect page as follow
rootPage:any;//=HomePage;
constructor(platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen,
private storage: Storage,
private changeDetectorRef: ChangeDetectorRef) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
// Check session and redirect
storage.get('session').then((val) => {
if(val){
this.rootPage=HomePage;
}else{
this.rootPage=LoginPage;
}
});
});
}
But my page is not redirecting .
What I tried -
1. Page is redirecting when I am using this.changeDetectorRef.detectChanges()
after setting rootpage, but my map in homepage is not loading when I am redirecting this way.
Is there any better solution to this problem?