繁体   English   中英

从ionic应用程序登录到仪表板时,菜单按钮显示为后退按钮

[英]when login from ionic app to dashboard the menu button showing as a back button

 import { Component} from '@angular/core'; import { NavController } from 'ionic-angular'; import { HomePage } from '../../pages/dashboard/home'; import { Signup } from '../../commen/signup/signup'; import { Forgot } from '../../commen/forgot/forgot'; import { NgForm } from '@angular/forms'; import { AuthService } from '../../services/auth.service' import { ToastController } from 'ionic-angular'; @Component({ selector: 'page-Login', templateUrl: 'login.html', providers: [AuthService] }) export class Login { forgot:any; spinnerLoad: boolean = false; msg:any; constructor(public navCtrl: NavController,private authservice: AuthService,public toastCtrl: ToastController) { this.forgot=Forgot; } Submitlogin(value: any) { if(value.email){ this.spinnerLoad = true; let email = value.email; let pass = value.password; this.authservice.login(email, pass).subscribe((result) => { this.spinnerLoad = false; if (result) if (result.status) { localStorage.setItem('userData', JSON.stringify(result.data)); this.navCtrl.push(HomePage); } else { const toast = this.toastCtrl.create({ message: 'Invalid credentials', duration: 3000, position: 'bottom' }); toast.present(); this.spinnerLoad = false; } }, error => { this.spinnerLoad = true; }); } } onSignup() { this.navCtrl.push(Signup); } facebookLogin(){ // alert('hello') // window.location.href = 'http://d4v.nextfellow.com/login/facebook'; } } 
 <form ngsubmit="formvalue()"> <ionic-input type="text" placeholder="email example"></ionic-input> <ionic-input type="text" placeholder="password"></ionic-input> <ion-col> <button ion-button [disabled]="!loginForm.form.valid" type="submit" block>Login</button> </ion-col> </form 
html是我的伪代码,一旦我确认表单并路由到显示为后退按钮的菜单按钮标题上的仪表板,但它应该是正确的菜单,请为此提供解决方案,我还有仪表板组件正在ionic 3上工作................................................... ..

我认为您应该使用this.navCtrl.setRoot(HomePage); 而不是this.navCtrl.push(HomePage);

还有另一种方法可以做到这一点。 HomePage.ts执行以下操作

import { ViewController } from 'ionic-angular';

constructor(public viewCtrl: ViewController) {}

ionViewWillEnter() {
  this.viewCtrl.showBackButton(false);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM