离子后退按钮与父母和孩子的状态

问题描述:

我有一个离子应用程序与以下ui路由器安装程序,其中locations状态是2状态的父母mapfavouritesupdates状态是一种详细信息可以从任何状态访问的页面。离子后退按钮与父母和孩子的状态

.state('locations', { 
    abstract: false, 
    cache: true, 
    url: '/locations', 
    templateUrl: 'templates/locations.html', 
    controller: 'LocationsCtrl' 
}) 
.state('locations.favourites', { 
    cache: true, 
    url: '/favourites', 
    templateUrl: 'templates/locations.favourites.html', 
    controller: 'LocationsFavouritesCtrl' 
}) 
.state('locations.map', { 
    cache: true, 
    url: '/map', 
    templateUrl: 'templates/locations.map.html', 
    controller: 'LocationsMapCtrl' 
}) 
.state('updates', { 
    cache: true, 
    url: '/updates/:place_id', 
    templateUrl: 'templates/updates.html', 
    controller: 'UpdatesCtrl', 
    params: {'place_id': 'undefined'} 
}) 


    // if none of the above states are matched, use this as the fallback 
    $urlRouterProvider.otherwise('/locations/map'); 

这是HTML

<body ng-app="app" animation="slide-left-right-ios7"> 
<div> 
    <div> 
     <ion-nav-bar class="bar-turq"> 
      <ion-nav-back-button class="button-icon icon ion-ios-arrow-back light"></ion-nav-back-button> 
     </ion-nav-bar> 
     <ion-nav-view></ion-nav-view> 
    </div> 
</div> 

这完美的作品,除了在“更新”的返回按钮的状态总是可以追溯到去locations.map,而不是想起了以前的状态,也就是我可能来自locations.favourites。我的设置有什么根本性错误吗?

**

  • UPDATE:

**

好了,所以里面UpdatesCtrl我加入这个代码来检查观看历史,不管在哪里我访问/更新视图,后视图是locations.map

$scope.$on('$ionicView.enter', function() { 
    console.log($ionicHistory.viewHistory()); 
} 

删除此PARAMS:{“place_id”:“未定义”}或确保您直通到$ place_id stateparams.place_id

我认为你是在没有未知状态结束(未解决)并进入默认状态。

您尚未发布默认路径。但我假设它有这个配置:$ urelRouterProvider.ohterwise('/ location.map');

+0

你的假设是正确的 - 我会尝试并检查。但我总是将place_id传递给“更新”状态。问题正在从它回来。 – rex

+0

其实我试图改变其他状态的路径,它没有任何区别。它总是回到同一点。我遇到的另一个有趣的事情是locations.map的状态永远不会被保存(或缓存),所以无论我何时去它,它都会从头开始排序或加载 – rex