离子中如何控制硬件后退按钮?

时间:2018-01-18 10:27:01

标签: javascript angularjs ionic-framework

我想从当前页面出去,然后转到主页。我这样做了:

$ionicPlatform.registerBackButtonAction(function() {
  if ($state.is('kegel') || $state.is('rest')) {
    backAsHome.trigger(function(){
      cancel();
      console.log('Success');
    }, function(){
      console.log('Error');
    });
  }
}, 100);

但得到了这个错误:

Uncaught ReferenceError: backAsHome is not defined
    at Object.fn (controllers.js:108)
    at Channel.hardwareBackButtonClick

0 个答案:

没有答案