How do I enable the physical button to perform a specific function on Ionic 3 ? (In this case, a function that makes the application open the homepage)
How do I enable the physical button to perform a specific function on Ionic 3 ? (In this case, a function that makes the application open the homepage)
Good afternoon Teiji, you can use the Platform service, with it you can register the button action with a function, for example:
export class AnyPage{
constructor(private navCtrl: NavController,
private platform: Platform) {
this.platform.registerBackButtonAction(() => {
this.navCtrl.pop();
});
}
}
From that moment on, whenever you hit the physical button on the phone, it will execute this.navCtrl.pop()
, but I do not know if using Native Transitions the NavController action will be useful.