N
N
nuclear_kote2016-05-23 02:21:25
Android
nuclear_kote, 2016-05-23 02:21:25

How to remove "back" button listener in ionics?

Registered the listener via $ionicPlatform.registerBackButtonAction(confirmExit, 100); I try to remove via $ionicPlatform.offHardwareBackButton(confirmExit) does not help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nuclear_kote, 2016-05-23
@nuclear_kote

var deregister;
$scope.$on('$ionicView.beforeEnter', function () {
deregister = $ionicPlatform.registerBackButtonAction(function (e) {
//suit yourself
});
});
$scope.$on('$ionicView.beforeLeave', function () {
deregister(); //remove listener
});

N
Nicholas, 2016-05-23
@ACCNCC

As an option, change the stub to a function)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question