嘿,我有一个关于离子导航的问题,
我的应用程序的主要导航是在页脚,但我想在 Headers 中添加一个信息选项卡,我也希望此选项卡有自己的视图所以我将其设置为如下所示
<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'
}
}
})
现在,据我所知,这应该做的伎俩,但问题是标签没有显示在 Headers 中,当我硬链接到路线时,它仍然保持在同一页面上没有任何错误...
我制作了模板,并配置了控制器 .
我是Angular和Ionic的新手,所以它可能很容易,但我无法弄清楚..我已经阅读了手册和文档 .
!!重要提示当我将视图更改为另一个视图时
.state('info.informatie', {
url: '/informatie',
views: {
'TAB-OMGEVING': {
templateUrl: 'templates/info-informatie.html',
controller: 'InfoCtrl'
}
}
它工作,但活动状态放在另一个选项卡上,历史堆栈追溯到该选项卡,这不是我打算做的,我宁愿从一开始就做,然后构建一个具有廉价修复和错误使用的应用程序码 .
有人能帮我吗?
1 回答
几点,我也是新手,但希望我有所帮助 .
我认为你的代码应该在nav-bar段中,nav-view应该留空,因为它是你的html填充的地方
使用ui-sref而不是href..like
<a ui-sref='info.informatie'>something</a>
或者也可以使用按钮来使用ui-sref .因为你使用info.something,自然你的父或基本状态是信息状态 .