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
See Question&Answers more detail:os"Uncaught TypeError: Cannot read property 'popPage' of undefined"