Android onHardwareBackButton behavior


I have a strange issue that i don’t undestand.
I would like to go on the previous page when user push the android back button. But if user is on ‘/1’ location, i’d like to exit the app.

$ionicPlatform.onHardwareBackButton(function() {
  if ($location.$$path=='\1')

When the value of $location.$$path is \1, the back button go only to the previous page.

Any idea on that issue?


add id attribute to that view and u can call like

if (document.getElementById(“1”))

It was just a mistake on slash ‘\1’ instead of ‘/1’… so stupid!

Well, it works now :slight_smile: