Hi How can i handle Device back button navigation using ionic 2.
We can do it by overriding by defining event for back button
platform.ready().then(() => {
document.addEventListener('backbutton', () => {
console.log('Back button tapped');
}, false);
});
2 Likes
This used to work,
but since i updated to
"ionic-angular": "^2.0.0-beta.4
the event is thrown, but still the nativ event gets executed…
so on Android the app minimizes
I tried to use, but still it wont work
document.addEventListener('backbutton',this.backbuttonEventHandler = (evt) => {
console.log("BaseHome.backbuttonEventHandler.")
evt.preventDefault();
}, false);
EDIT
After starting a new project an migrating all files i’ve got it to work again!