首页 文章

过渡到'nephew'状态时,离子视图 Headers 未更新

提问于
浏览
1

基本上我正在尝试从root.home状态转换到root.topic.section(带有嵌套剖面视图的主题视图) . 视图加载但我的后退按钮和视图 Headers 不会出现 . 视图 Headers 与root.home中的视图 Headers 保持一致 . 我不明白,因为当我使用ui-sref改变兄弟状态(没有子状态)时,它会改变 Headers .

EDIT: 当我从root.home导航到同级页面root.dbtest时,dbtest在DOM中使用正确的 Headers 创建了一个新的navbar元素,并设置了home 's navbar to ' cached' . 但是当我从root.home导航到root.topic.section时,没有创建新的DOM元素,并且home仍然处于活动状态 .

EDIT 2 这是'ui-sref'我用来从root.home链接到子状态 .

<a ui-sref="root.topic.section({topicId: xxx, inStore: false, topicName: xxx, sectionType: SECTION_TYPE.Summary})">link</a>

.

$stateProvider
    .state('root', {
        url: '/root',
        abstract: true,
        templateUrl: 'templates/menu-static.html',
        controller: 'MenuCtrl'
    })
    .state('root.home', {
        url: '/home',
        views: {
            'menuContent': {
                templateUrl: 'templates/home.html',
                controller: 'HomeCtrl'
            }
        }
    })
    .state('root.topic', {
        url: '/topic/:topicId/{inStore}',
        abstract: true,
        cache: false,
        views: {
            'menuContent': {
                templateUrl: 'templates/topic-view.html',
                controller: 'TopicCtrl'
            }
        },
        params: {topicName: null}
    })

    .state('root.topic.section', {
        url: '/section/:sectionType',
        views: {
            'sectionSpace': {
                templateUrl: 'templates/topic-section-view.html',
                controller: 'TopicSectionCtrl'
            }
        }
    })

这是我的menu-static.html的一个片段

<ion-side-menu-content>
  <ion-nav-bar class="bar-stable">
    <ion-nav-back-button>
    </ion-nav-back-button>
    <ion-nav-buttons side="right">
        <button class="button button-icon button-clear ion-navicon" menu-toggle="right">
        </button>
    </ion-nav-buttons>
  </ion-nav-bar>
  <ion-nav-view name="menuContent">

  </ion-nav-view>
</ion-side-menu-content>

这是home.html的一个片段

<ion-view view-title="All Topics">
  <ion-nav-title>All Topics</ion-nav-title>
  <ion-content>
  </ion-content>
</ion-view>

这是topic-view.html的一个片段

<ion-view view-title="NOT SHOWING">
  <ion-nav-title>NOT SHOWING</ion-nav-title>
  <ion-content>
    <ion-nav-view name="sectionSpace">
    </ion-nav-view>
  </ion-content>
</ion-view>

1 回答

  • 2

    另外:Url目前将是/ root / topic / ...这似乎是不可取的=>你可以让root拥有 url: '', 这将允许url为/ topic /以上对我来说效果不好所以我试过这个亲自,它确实为父母工作:

    话题view.html

    <ion-view view-title="NOT SHOWING">
        <div class="tabs-striped tabs-top tabs-background-balanced tabs-color-light">
        <div class="tabs">
          <a ng-repeat='section in ["Section1", "Section2", "Section3"]' class="tab-item" ng-click='goTo(section.toLowerCase())'>
            {{section}}
          </a>
        </div>
      </div>
      <ion-nav-view name='sectionSpace'></ion-nav-view>
    </ion-view>
    

    它确实有效 . I 'm not sure what this is about but maybe that' s对于Ionic / Angular的早期版本我认为我在这个codepen中使用了这个:http://codepen.io/zargold/pen/qZNJNJ?editors=1011

相关问题