3

我有一个选项卡式应用程序,它以ionic start myApp tabs. 我一直在编辑它,并添加了一个名为count.html共享DashCtrl控制器的页面。我在 Dash 选项卡中链接到它,当我在计算机上的 Chrome 中进行测试时它工作正常,但是当我使用 Ionic Viewer 时,它无法导航;它只是停留在 Dash Tab 页面上,就好像什么都不应该发生一样。

如何修复设备的导航?

制表符.html

<ion-view view-title="Test">

  <ion-content class="padding">

    <button class="button button-full button-positive" ui-sref="tab.count">
        Count
    </button>

  </ion-content>
</ion-view>

计数.html

<ion-view view-title="Count">

    <ion-nav-bar class="bar-energized">
        <ion-nav-back-button class="button-clear">
            <i class="ion-arrow-left-c"></i> Back
        </ion-nav-back-button>
    </ion-nav-bar>

  <ion-content class="padding">

  </ion-content>
</ion-view>

应用程序.js

  .state('tab', {
    url: "/tab",
    abstract: true,
    templateUrl: "templates/tabs.html"
  })

  // Each tab has its own nav history stack:

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

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

2 回答 2

1

这似乎是一个离子视图错误。一旦我从 Switcher 中终止了该应用程序,路由就可以正常工作。编辑:确认是UIWebViewIonic View 应用程序中的缓存错误。

https://github.com/driftyco/ionic-view-issues/issues/10

似乎无论您设置什么缓存策略,它都只会应用于初始请求(在本例中为 index.html),并且无论如何都从缓存中加载所有 CSS 和 JS。

于 2015-03-03T22:23:53.540 回答
0

我有一个类似的问题,并且能够通过将“./”放在 templateUrl 的开头来解决它。尝试

templateUrl: './templates/count.html',
于 2015-03-03T21:15:32.287 回答