Im using Onsen 1.3.14. From what I've read, I thought android backbutton should be calling navi.popPage() by default, but instead my application always exited.
I also have tried using this
but it still wont work.
Is it a bug? Is there a workaround to make android backbutton not exiting the app?
Thanks.
Regards
It's not true that the android backbutton should be calling navi.popPage()
. What if, for example, there is a sliding menu instead of a navigator?
If you want to implement a popPage
, you can write something like this:
document.addEventListener("backbutton",onBackButtonPressed, false);
function onBackButtonPressed(){
var element = document.querySelector("ons-navigator");
element.popPage();
}
If you want to learn more about how to handle the android backbutton in Onsen UI, you can take a look at the official documentation: