Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Onsen UI2 - handling the hardware back button



  • Can someone help me on, how to handle device back button.
    I am using Cordova+Angular5+OnsenUI2

    export class AppComponent implements OnInit {
      initialPage = FirstPageComponent;
      ngOnInit() {
        ons.ready((e) => {
          ons.disableDeviceBackButtonHandler();
          // ons.onDeviceBackButton();
        });
      }
    }
    
    

    Please help me how to handle backbutton, i would like execute a scenario where i have Page1, Page2, Page3.
    When i am in Page3 when device backbutton pressed it should go to Page 2, then same for Page2, Once it reached to Page1 on click on back it should popup for exit app? if yes terminate app.