【问题标题】:Navigation works in browser but not in Ionic View iphone app导航在浏览器中有效,但在 Ionic View iphone 应用程序中无效
【发布时间】:2015-05-04 15:02:28
【问题描述】:

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

如何修复设备的导航?

tab-dash.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>

count.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>

app.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'
      }
    }
  })

【问题讨论】:

    标签: angularjs ionic-framework angularjs-routing ionic ui-sref


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,可以通过在 templateUrl 的开头添加“./”来解决它。试试看

      templateUrl: './templates/count.html',
      

      【讨论】:

      • 遗憾的是没有工作。我通过 Chrome 应用程序访问了该应用程序并且它可以工作,所以这可能只是一个 Ionic View 错误。
      猜你喜欢
      • 2015-08-28
      • 2015-08-11
      • 2015-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-08
      相关资源
      最近更新 更多