Navigate to certain page on hardware back button

Hi,

I have the following issue: I want to manipulate the hardware back button in a way that it links to a certain page.

So I did the following in the controller:

	$scope.toRequests = function() {
             $location.path("/requests");
	});

	
        $ionicPlatform.onHardwareBackButton($scope.toRequests);

This does not work at all. The hardware back button simply goes back to the last page. Also with $scope.$apply() it does not work.

Then I changed the function to:

$scope.toRequests = function() {
	$timeout(function() {
		$location.path("/requests");
	});
}

In this case, the back button links to the desired page. However, only after about 1 second. First, the back button goes to the previous page and after 1 second the user is redirected to /requests.

So obviously the hardware backbutton functionality is not overriden. Any ideas?

Regards,

Mike

1 Like