0
I’m using this command this.navCtrl.push('HomePage');
to navigate between pages on ionic 3
but I need to make sure he doesn’t show up like this:
I can’t give the guy a chance to get back to the next screen.
Actually what I need is a if()
if the user is already logged in to rootPage is one if it is not another.
How to do this ?
I tried to do so:
export class MyApp {
rootPage:any = LoginPage;
constructor(public navCtrl: NavController,private storage: Storage, platform: Platform, private statusBar: StatusBar, splashScreen: SplashScreen) {
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();
// let status bar overlay webview
this.statusBar.overlaysWebView(true);
this.storage.get('cliente').then((val) => {
if(val != null || val != undefined){
this.navCtrl.setRoot(RestaurantePage);
}else{
this.navCtrl.setRoot(LoginPage);
}
});
// set status bar to white
this.statusBar.backgroundColorByHexString('#ffc107');
//statusBar.backgroundColorByHexString("ffc107");
splashScreen.hide();
});
}
}
This is the mistake:
Uncaught Error: Can’t resolve all Parameters for Myapp: ([Object Object], ?, [Object Object], [Object Object], [Object Object]). syntat axError (http://localhost:8100/build/main.js:79180:34) At compilemetadataresolver. _getDependenciesMetadata (http://localhost:8100/build/main.js:92517:35) At compilemetadataresolver. _getTypeMetadata (http://localhost:8100/build/main.js:92385:26) At Compilemetadataresolver.getNonNormalizedDirectiveMetadata (http://localhost:8100/build/main.js:91994:24) At compilemetadataresolver. _getEntryComponentMetadata (http://localhost:8100/build/main.js:92638:45) at http://localhost:8100/build/main.js:92624:48 at Array.foreach (Native) At compilemetadataresolver. _getEntryComponentsFromProvider (http://localhost:8100/build/main.js:92623:30) at http://localhost:8100/build/main.js:92587:83 at Array.foreach (Native) syntaxError @ VM21376 main.js:79180 Compilemetadataresolver. _getDependenciesMetadata @ VM21376 main.js:92517 Compilemetadataresolver. _getTypeMetadata @ VM21376 main.js:92385 Compilemetadataresolver.getNonNormalizedDirectiveMetadata @ VM21376 main.js:91994 Compilemetadataresolver. _getEntryComponentMetadata @ VM21376 main.js:92638 (Anonymous) @ VM21376 main.js:92624 Compilemetadataresolver. _getEntryComponentsFromProvider @ VM21376 main.js:92623 (Anonymous) @ VM21376 main.js:92587 Compilemetadataresolver. _getProvidersMetadata @ VM21376 main.js:92551 (Anonymous) @ VM21376 main.js:92126 Compilemetadataresolver.getNgModuleMetadata @ VM21376 main.js:92117 Jitcompiler. _loadModules @ VM21376 main.js:103270 Jitcompiler.compileModuleAndComponents @ VM21376 main.js:103229 Jitcompiler.compileModuleAsync @ VM21376 main.js:103191 Platformref.bootstrapModuleWithZone @ VM21376 main.js:5141 Platformref.bootstrapModule @ VM21376 main.js:5127 (Anonymous) @ VM21376 main.js:115016 webpack_require @ VM21376 main.js:48 (Anonymous) @ VM21376 main.js:140 (Anonymous) @ VM21376 main.js:143
You installed the plugin and followed the steps it says here https://ionicframework.com/docs/storage/ ?
– André Vicente