Ionic 1 hardware backbutton. need help!

hi, i am working on ionic 1 app.

while exiting app i want to check state and exit else go to previous state. is there any code snippet for that?

search for registerbackbutton in ionic… there are plenty of sample codes… or even just search for a topic with registerbackbutton in this forum site…