onsen-ui

How to control android backbutton routes?

独自空忆成欢 提交于 2019-12-01 05:51:58
The default in Onsen is that the app closes/exits when the device backbutton is pressed. Is there any way to control that in Onsen to also mimic the ons-navigator action/page history? Thanks! In case of PhoneGap/Cordova, backbutton event is fired when the backbutton is pressed. Therefore, you can set the eventhandler s.t. document.addEventListener("backbutton", onBackKeyDown, false); In eventhandler function, you can call popPage method of navigator by obtaining the navigator scope s.t. function onBackKeyDown() { // Handle the back button alert("Backbutton is pressed!"); var element = document

How to control android backbutton routes?

守給你的承諾、 提交于 2019-12-01 03:44:51
问题 The default in Onsen is that the app closes/exits when the device backbutton is pressed. Is there any way to control that in Onsen to also mimic the ons-navigator action/page history? Thanks! 回答1: In case of PhoneGap/Cordova, backbutton event is fired when the backbutton is pressed. Therefore, you can set the eventhandler s.t. document.addEventListener("backbutton", onBackKeyDown, false); In eventhandler function, you can call popPage method of navigator by obtaining the navigator scope s.t.

Onsen uI:Controll android backbutton routes:

萝らか妹 提交于 2019-11-29 16:10:22
I am developing an android application in cordova using Onsenui,in which i want to navigate to previous page when device backbutton is clicked I am using answer from this question to solve the issue Here is my code document.addEventListener("backbutton",onBackButtonPressed, false); function onBackButtonPressed(){ alert('backbutton'); var element = document.querySelector( ".navigator-container"); var scope = angular.element( element ).scope(); scope.popPage(); } I will get the following error "Uncaught TypeError: Cannot read property 'popPage' of undefined" Probably .navigator-container has

AngularJS OnsenUI reload parent page on nav.popPage() in child page

与世无争的帅哥 提交于 2019-11-29 07:55:01
I'm calling a function on ng-init and in that page I'm pushing a new page to the pageStack of navigator on a button click. And in the child page I'm popping the current page. Now I want to reload the parent page when the child page is removed from page stack. Here is the code: HTML <ons-navigator var="nav" page="page1.html"> </ons-navigator> <ons-template id="page1.html"> <ons-page ng-controller="pageOneController" ng-init="reload()"> <ons-toolbar> <div class="center">Page 1</div> </ons-toolbar> <ons-button ng-click="nav.pushPage('page2.html')">Push Page</ons-button> </ons-page> </ons-template

AngularJS OnsenUI reload parent page on nav.popPage() in child page

感情迁移 提交于 2019-11-28 01:47:38
问题 I'm calling a function on ng-init and in that page I'm pushing a new page to the pageStack of navigator on a button click. And in the child page I'm popping the current page. Now I want to reload the parent page when the child page is removed from page stack. Here is the code: HTML <ons-navigator var="nav" page="page1.html"> </ons-navigator> <ons-template id="page1.html"> <ons-page ng-controller="pageOneController" ng-init="reload()"> <ons-toolbar> <div class="center">Page 1</div> </ons