android - 在 Ionic 上使用 Android 的 history.back()

标签 android refresh history ionic-framework

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

最佳答案

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

参见:$ionicNavBarDelegate

HTML

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

Javascript Controller

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

关于android - 在 Ionic 上使用 Android 的 history.back(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25494627/

相关文章:

jquery - 页面加载时滚动到给定的 jCarousel 幻灯片

java - android 将变量从一种方法传递到另一种方法

javascript - 调用 history.back() 不触发 'popstate'

android - iOS 中是否有等效的 Android 旋转矢量?

android - Android 上的刷新选项卡 Activity

c# - Entity Framework 核心 ObjectContext.Refresh 等效项

java - 如何更新JFrame组件?

python - Linux 历史到 Python 变量

Android:旋转屏幕时删除/销毁对象

android - observeOn() 影响 doOnTerminate() 调用