Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49247

Android back button always get triggered even after closing the page

$
0
0

@MohanadZahed wrote:

I have successfully changed the back button behavior on Android using this code in the page’s constructor

let backAction = platform.registerBackButtonAction(() => {
let alert = this.alertCtrl.create({
message: ‘Are you sure that you want to go back?. If you go back all data will be lost’ ,
buttons: [
{
text: ‘yes’,
handler: () => {
this.navCtrl.pop();
}
},
{
text: ‘no’
}
]
});
alert.present();
},1)

The problem is this code keeps triggered every time I press the back button even after going back or closing the page.
Anyone knows what the problem might be?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>