标题中的离子导航选项卡

时间:2014-06-13 10:43:45

标签: javascript angularjs url-routing angularjs-routing ionic-framework

嘿,我有一个关于离子导航的问题,

我的应用程序的主导航是在页脚中,但我想在标题中添加一个信息选项卡,我也希望此选项卡具有自己的视图,所以我将其设置如下所示

 <ion-nav-bar class="bar-stable nav-title-slide-ios7">
  <ion-nav-back-button class="button-icon icon  ion-ios7-arrow-back">
    Back
  </ion-nav-back-button>
  <ion-nav-buttons side="right">
    <ion-tabs class="tabs-icon-top">

    <!-- Info Tab -->
    <ion-nav-view>
      <ion-tab title="Info" icon="icon ion ion-android-information" href="#/info/informatie">
        <ion-nav-view name="info-informatie"></ion-nav-view>
      </ion-tab>
     </ion-tabs>
    </ion-nav-view>


  </ion-nav-buttons>
</ion-nav-bar>

我将Angular路由配置为这样的抽象类,

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

    .state('info.informatie', {
        url: '/informatie',
        views: { 
            'info-informatie': {
                templateUrl: 'templates/info-informatie.html',
                controller: 'InfoCtrl'
            }
        }
    })

现在据我所知,这应该可以解决问题,但问题在于 选项卡没有显示在标题中,当我硬链接到路线时,它仍保留在同一页面上,没有任何错误......

我制作了模板,并配置了控制器。

我是Angular和Ionic的新手,所以它可能很容易,但我无法理解......我已经阅读了手册和文档。

!!重要通知 当我将视图更改为另一个视图时

.state('info.informatie', {
        url: '/informatie',
        views: { 
            'TAB-OMGEVING': {
                templateUrl: 'templates/info-informatie.html',
                controller: 'InfoCtrl'
            }
        }

它可以工作,但是活动状态放在另一个选项卡上,历史堆栈追溯到那个不是我打算做的选项卡,我宁愿从一开始就做,然后用廉价的修复程序构建一个应用程序错误使用代码。

有人能帮助我吗?

1 个答案:

答案 0 :(得分:2)

有几点,我也是新手,但希望我有所帮助。

  1. 我认为您的代码应该在导航栏中,导航视图应该留空,因为它是html填充的地方
  2. 使用ui-sref代替href..like <a ui-sref='info.informatie'>something</a>,或者使用按钮来支持ui-sref。
  3. 因为你使用了info.something,你的父状态或基本状态自然就是信息状态。
相关问题