Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden tab attribute for ion-tab elements #1666

Closed
ducdigital opened this issue Jun 24, 2014 · 12 comments
Closed

Hidden tab attribute for ion-tab elements #1666

ducdigital opened this issue Jun 24, 2014 · 12 comments
Assignees
Labels
needs: reply the issue needs a response from the user

Comments

@ducdigital
Copy link

This will help people able to implement both side-menu and ion-tabs at once.

In the file: ** js / angular / directive / tab.js **

Change:

tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));

to

if ($attr.hidden !== 'true') { tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope)); }

This allow a hidden="true" attribute in the ion-tab element. It will hide the button but view/controller will continue to works as normal. We can access it by route or other mean like a normal tab.

I hope we can implement this if there are no problem :)

@perrygovier
Copy link
Contributor

Hey @ducdigital, what would the use case be for a hidden tab item? I used them before in a personal project, but later found it was unnecessary. Hiding tab elements feels like a bandaid solution to something Ionic should do better in the first place, or the app's routes could be organized differently.

@perrygovier perrygovier self-assigned this Jun 24, 2014
@calendee
Copy link

See also : Issue #1163

This is a pretty common request. For example, I want the GUI to ALWAYS show the tab bar. However, I have a view that I don't want accessible via the tab bar. Within the GUI, I want to be able to show that view.

A hidden tab allows me to :

  • Always show the tab bar
  • Hide content from the user
  • Display that content when I want to & keep the tab bar visible at all times

The alternative of a different state outside the "tab." means a navigation event happens, taking the user away from the tabs, and now, they have to use a back button to get back inside of just tapping a tab.

A few other examples of people requesting this:

@calendee
Copy link

Just found another request : Issue #1673

@calendee
Copy link

Thanks Ionic team. Here's a sample CodePen for anyone stumbling across this

http://codepen.io/calendee/pen/HvlAu

@jianbo
Copy link

jianbo commented Sep 25, 2014

Saved my hair :)

@jason-engage
Copy link

Does anyone know how to properly hide and show tab items? Like a method to toggle them individually?

I found it : http://codepen.io/anon/pen/DqyeI?editors=101

Btw, the mix of Github's issue centre and the Ionicframework's forum can be kind of confusing to navigate and figure out solutions! I love all the codepens tho!

@JobaDiniz
Copy link

It is related if you think about.

My scenario, described here, it a little bit different.

I want all tabs to be visible at all times, but I don't want to link all my states to one particular tab. All my states, except each root tabs states, should be rendered in the current selected tab.

Did I made this up? No... Facebook (iOS) does exactly that. They have a set of fixed tabs and all other "states/views" are rendered in the active tab. - it's genius.

Unfortunately, I wasn't able to hack things around to make this work (tried a few things, like creating views state object on the fly...).

For example
I will not configure app.search state to any tab (using views state config)... app.search does not belong to any tab... it belongs to the current one.
Same for my app.user (/user/{id:int})... state.go('app.user', {id: 3}) should be rendered in the current tab.

@elineopsommer
Copy link

elineopsommer commented May 12, 2016

Hi,
How is this done in Ionic2? I tried:

<ion-tab [root]="TeamPage" [attr.hidden]="true" tabIcon="settings"></ion-tab>
<ion-tab [root]="TeamPage" [hidden]="true" tabIcon="settings"></ion-tab>

but no luck.

@MrFragStealer
Copy link

MrFragStealer commented Feb 8, 2017

hi, @elineopsommer did you figure it out?
I'm also interested how to do this in Ionic 2.

For now I used some css to achieve this:
#tab-t0-0 {
display:none;
}
//this will hide tab 0 button

@kyr0
Copy link

kyr0 commented Jun 26, 2017

@MrFragStealer Your solution works, but isn't very dynamic or programmatically controllable. I think, this Directive is cleaner:

TabHiddenDirective

@harshasanjeeva
Copy link

@MrFragStealer thanks it works

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

No branches or pull requests

10 participants