Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49076

$ionicPlatform.registerBackButtonAction priority 102 (or higher) works but 101 or 100 does not

$
0
0

@redfox05 wrote:

Strangely enough, when trying to catch the use of the back button on view changes, using $ionicPlatform.registerBackButtonAction with a priority of 100 or 101, did not work and did not trigger the back button code, but setting it to 102 (or anything above that) made it work. How is that? The code is very basic:

Within the angular .run() function:

$ionicPlatform.registerBackButtonAction(function() {
  log.info('Device Back button pressed');
  if (true) { // your check here
    $ionicPopup.confirm({
      title: 'System warning',
      template: 'are you sure you want to exit?'
    }).then(function(res) {
      if (res) {
        ionic.Platform.exitApp();
      }
    });
  }
}, 102);

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49076

Trending Articles