Ionic 2: How to handle the hardware back button which checks confirmation of Exit in app

前端 未结 7 647
你的背包
你的背包 2020-12-05 06:12

I am facing an issue how to handle the default mobile\'s back button which checks the confirmation while exiting from the application, if I pressed the back button there sho

7条回答
  •  感情败类
    2020-12-05 06:52

    Platform api has a handler registerBackButtonAction.

    You can do something like:

    In app.component.ts

        constructor(platform: Platform){
         platform.ready().then(()=>{
           platform.registerBackButtonAction(()=>this.myHandlerFunction());
    })
    
    
      myHandlerFunction(){
        //create alert
         }
    

提交回复
热议问题