Estou utilizando este comando this.navCtrl.push('HomePage');
para navegar entre as paginas no ionic 3
porém preciso fazer com que ele não apareça assim o:
Não posso da a chance do cara voltar para próxima tela.
Na verdade o que preciso é um if()
se o usuário ja estiver logado a rootPage é uma se não é outra.
Como fazer isto ?
Tentei fazer assim:
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();
});
}
}
Este é o erro:
Uncaught Error: Can't resolve all parameters for MyApp: ([object Object], ?, [object Object], [object Object], [object Object]). at syntaxError (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