【问题标题】:history.back() with Android on Ionic在 Ionic 上使用 Android 的 history.back()
【发布时间】:2014-08-25 21:26:53
【问题描述】:

使用 Ionic 在 Android 上调用 history.back() 时如何不刷新页面?它在 iOS 上运行良好,但在 Android 上它正在重新加载页面。我在科尔多瓦 3.5 上。

【问题讨论】:

标签: android refresh history ionic-framework


【解决方案1】:

您正在寻找$ionicNavBarDelgate.back() 方法。这使用ui.router 状态在历史记录中导航而不重新加载页面。

见:$ionicNavBarDelegate

HTML

<button type="button" class="button button-clear" ng-click="goBack()">Back</button>

Javascript 控制器

angular.module('App').controller('PageCtrl', function ($scope, $ionicNavBarDelegate) {
  $scope.goBack = function () {
    $ionicNavBarDelegate.back();
  };
});

【讨论】:

  • $ionicNavBarDelegate.back();被贬低了。使用 $ionicHistory.goBack();而是
  • 谢谢你,@Nico!我到处找这个!
猜你喜欢
  • 2016-08-21
  • 2014-08-12
  • 1970-01-01
  • 2017-06-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-29
相关资源
最近更新 更多