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

前端 未结 7 632
你的背包
你的背包 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:48

    Html:

    TypeScript:

    import {Platform} from 'ionic-angular';
    
    @Page({ /*...*/ })
    export MyPage {
     constructor(platform: Platform) {
      this.platform = platform;
     }
     exitApp(){
      this.platform.exitApp();
     }
    }
    

提交回复
热议问题