Ionic back-button event


#1

Hi all ! Could anyone suggest please, is it possible handle event on back-button in the header ?


#2

I also would like to know how to handle the back button. I would like to have a function like:

onBackButtonClick(
preventDefaultBackButton();
// some other code
)


#3

I was able to figure it out!
In the .html I put:

<ion-header>
	<ion-navbar>
		    <ion-buttons left>
		        <button ion-button icon-only (click)="onBackButton()" >
		            <ion-icon name="arrow-back"></ion-icon>
		        </button>
		    </ion-buttons>
	    <ion-title>Roof Systems</ion-title>
 	</ion-navbar>
</ion-header>

In the .ts TypeScript, I put:

onBackButton() {
              let check: boolean = false;
               // functionality code
		if ( check ) {
			this.navCtrl.pop();	
		}				
	}