handling android device back button with phonegap and angular js

The mobile application which we developed using phonegap (cordova-2.7.0) and Angular JS have a requirement that, on tapping the device back button from any page, the application should redirect to home page and if the user taps the device back button from home page, application should exit.

I could find a lot of websites which says that, we can control the device back button using phonegap and then, they just pasted the code from phonegap’s official website, like given below.

There is no good example available, which drives me crazy.

Hence, I thought of sharing this small example, which might be helpful for so many developers who is searching for a solution for┬áhandling android device back button with phonegap and angular js. Continue reading “handling android device back button with phonegap and angular js”