android - Trouble getting ng-device-back-button directive to work for OnsenUI v2 -


i'm attempting stop user abandoning game accidentally clicking device button on android devices. i'm using cordova 6.3.1 , onsen ui v2 framework.

by using onsen page's ng-device-back-button attribute, have been able disable button, prefer ask user if wanted leave confirm. @ point, happy if write console user has clicked device button, seems nothing happening other ng-device-back-button attribute preventing default.

<ons-page ng-device-back-button="onbackkeydown">     ... </ons-page>  $scope.onbackkeydown = function(e) {     console.log("device button pressed"); } 

with above code, i'm able prevent onsen standard poppage() reaction, nothing being written console.

any thoughts on i'm doing incorrectly? in advance.

try

ng-device-back-button="onbackkeydown()" 

instead of

ng-device-back-button="onbackkeydown" 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -