I'm using this command this.navCtrl.push('HomePage');
to navigate between pages in ionic 3
but I need to make it not appear like this:
Icannotgivetheguythechancetogobacktothenextscreen.
InfactwhatIneedisaif()
iftheuserisalreadyloggedintorootPageitisoneifitisnotanother.
Howtodothis?
Itriedtodothis:
exportclassMyApp{rootPage:any=LoginPage;constructor(publicnavCtrl:NavController,privatestorage:Storage,platform:Platform,privatestatusBar:StatusBar,splashScreen:SplashScreen){platform.ready().then(()=>{//Okay,sotheplatformisreadyandourpluginsareavailable.//Hereyoucandoanyhigherlevelnativethingsyoumightneed.//statusBar.styleDefault();//letstatusbaroverlaywebviewthis.statusBar.overlaysWebView(true);this.storage.get('cliente').then((val)=>{if(val!=null||val!=undefined){this.navCtrl.setRoot(RestaurantePage);}else{this.navCtrl.setRoot(LoginPage);}});//setstatusbartowhitethis.statusBar.backgroundColorByHexString('#ffc107');//statusBar.backgroundColorByHexString("ffc107");
splashScreen.hide();
});
}
}
This is the error:
Uncaught Error: Can not resolve all parameters for MyApp: ([object Object],?, [object Object], [object Object], [object Object]). at syntaxError ( link ) at CompileMetadataResolver._getDependenciesMetadata ( link ) at CompileMetadataResolver._getTypeMetadata ( link ) at CompileMetadataResolver.getNonNormalizedDirectiveMetadata ( link ) at CompileMetadataResolver._getEntryComponentMetadata ( link ) at link at Array.forEach (native) at CompileMetadataResolver._getEntryComponentsFromProvider ( link ) at link 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