使用 Ionic / UI-Router 很难达到子状态

Difficulties reaching a child state with Ionic / UI-Router

我有以下 父级 状态:

  // setup an abstract state for the tabs directive
  .state('tab', {
    url: "/tab",
    abstract: true,
    templateUrl: "templates/tabs.html",
    controller: "TabCtrl"
  })

  // Each tab has its own nav history stack:
  .state('tab.home', {
    url: '/home',
    views: {
      'menuContent': {
        templateUrl: 'templates/tab-home.html',
        controller: 'HomeCtrl',
        resolve: {authResolve: authResolve}
  }
}

})

// 
.state('tab.dash', {
    url: '/dash',
    views: {
      'menuContent': {
        templateUrl: 'templates/tab-dash.html',
        controller: 'DashCtrl',
        resolve: {authResolve: authResolve}
      }
    }
  })

以及 child 状态 tab.dash

  .state('tab.album', {
    url: '/dash/:albumName',
    views: {
      'menuContent': {
        templateUrl: 'templates/tab-album.html',
        controller: 'AlbumCtrl',
        resolve: {authResolve: authResolve}
      }
    }
  })

另外我还有一个独立

// none tabs/nonview pages
  .state('neutral', {
    url: '/neutral',
    templateUrl: 'templates/single-neutral.html',
    controller: 'NeutralCtrl',
    resolve: {authResolve: authResolve}
  })

问题

在独立状态 neutral 中,当我尝试重定向到子状态 tab.album 时,只有当我首先从 tab.album 到达 neutral 状态时它才有效.当我从 tab.home 到达 neutral 然后尝试重定向到 tab.album 时,我被重定向到 tab.dashtab.album 的父级。所以为了更清楚:

这个有效:

tab.home > tab.dash > tab.album > neutral > tab.album

有效:

tab.home > neutral > tab.album

这是什么原因,我该如何解决?

这里有一篇博客 post 展示了如何强制选项卡在激活时转到顶层。 http://www.clearlyinnovative.com/ionic-framework-tabs-go-home-view/

您应该能够使用相同的方法告诉选项卡根据您传递给它的 stateParameter 转到特定的子状态。