How to control hardware back and toolbar back button in ionic 3
Here is two method work for hardware and toolbar backbutton control
this method use for toolbar back button control
import { Component,ViewChild } from '@angular/core'; import { IonicPage, NavController, NavParams ,Platform,AlertController,Navbar } from 'ionic-angular'; @ViewChild(Navbar) navBar: Navbar; this.navBar.backButtonClick = (e:UIEvent)=>{ // todo something this.navCtrl.push(LoginPage); }
this method use for hardware back button control
import { Platform} from 'ionic-angular'; this.platform.registerBackButtonAction(() => { // this.showalert(); },1);
Share