i have the same requirement as you,
i have 3 “main” views where i want to show the tab and some subviews where i don’t want them so i gain more space on view.
There are multiple options to archive this.
first something like you mentioned using ng-hide=“hideTab” with a $rootScope variable.
you can then set in your view controller true or false. (not tested)
second what i did:
Structure:
- main.html
–> tabs.html
—> homeTabOne.html
—> homeTabTwo.html
—> homeTabThree.html
–> all other views
so in short i run all Tab based Views in the tabs.html
and all other in main.html
the routing will look like this:
.config(($stateProvider, $urlRouterProvider) => {
console.log("**** app.config.routers");
$stateProvider
.state('main', {
url: "",
abstract: true,
templateUrl: "views/main.html"
})
.state('main.tabs', {
url: "/tab",
abstract: true,
views: {
'main-content': {
templateUrl: "views/tabs.html",
}
}
})
// --------- Tabs ---------
.state('main.tabs.homeTabOne', {
url: "/homeTabOne",
views: {
'home-tab': {
templateUrl: "views/homeTabOne/home.html",
controller: "homeTabOneController"
}
}
})
.state('main.tabs.homeTabTwo', {
url: "/homeTabTwo",
views: {
'about-tab': {
templateUrl: "views/homeTabTwo/home.html",
controller: "homeTabTwoController"
}
}
})
.state('main.tabs.homeTabThree', {
url: "/homeTabThree",
views: {
'contact-tab': {
templateUrl: "views/homeTabThree/homeTabThrees.html",
controller: 'homeTabThreesController'
}
}
})
// --------- homeTabOne ---------
.state('main.homeTabOneAdd', {
url: "/homeTabOne/add",
views: {
'main-content': {
templateUrl: "views/homeTabOne/add.html",
controller: "AddhomeTabOneController"
}
}
})
.state('main.homeTabOneChange', {
url: "/homeTabOne/change",
views: {
'main-content': {
templateUrl: "views/homeTabOne/change.html",
controller: 'homeTabOneChangeController'
}
}
})
// --------- homeTabTwo ---------
.state('main.homeTabTwoAdd', {
url: "/homeTabTwo/add",
views: {
'main-content': {
templateUrl: "views/homeTabTwo/add.html"
}
}
})
...
// --------- homeTabThree ---------
.state('main.homeTabThreeAbout', {
url: "/homeTabThree/about",
views: {
'main-content': {
templateUrl: "views/homeTabThree/about.html"
}
}
})
...
;
$urlRouterProvider.otherwise("/tab/homeTabOne");
})
main.html:
<ion-nav-bar class="bar-positive avant" animation="nav-title-slide-ios7" ></ion-nav-bar>
<ion-nav-view name="main-content"></ion-nav-view>
tabs.html
<ion-tabs class="tabs-icon-top" >
<ion-tab title="tabOne" icon="ion-one" href="#/tab/homeTabOne">
<ion-nav-view name="home-tab"></ion-nav-view>
</ion-tab>
<ion-tab title="TabTwo" icon="ion-two" href="#/tab/homeTabTwo" id="step2">
<ion-nav-view name="about-tab"></ion-nav-view>
</ion-tab>
<ion-tab titleTabThree" icon="ion-ios7-gear-outline" ui-sref="main.tabs.homeTabThree">
<ion-nav-view name="contact-tab"></ion-nav-view>
</ion-tab>
</ion-tabs>
one of the bad things with this method: routing and transitions do not really work :-/