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

bug(tabs) : ngIf changes tab order #5768

Closed
dylanvdmerwe opened this issue Mar 8, 2016 · 4 comments
Closed

bug(tabs) : ngIf changes tab order #5768

dylanvdmerwe opened this issue Mar 8, 2016 · 4 comments
Assignees
Milestone

Comments

@dylanvdmerwe
Copy link
Contributor

Short description of the problem:

When binding to a specific ion-tab to make it visible or not, the tab ordering is incorrect.

What behavior are you expecting?

I want to bind a specific tab to a variable on whether it should show or not. The tab bar does hide/show the tab. However when the tab is shown, it's at the end of the tab bar instead of where it is specified in the HTML.

HTML - note the invite tab position

<ion-tabs>
    <ion-tab [root]="tab1Root" tabTitle="Invite" tabIcon="people" *ngIf="competitionRunning"></ion-tab>
    <ion-tab [root]="tab2Root" tabTitle="Info" tabIcon="information-circle"></ion-tab>
    <ion-tab [root]="tab3Root" tabTitle="Gallery" tabIcon="images"></ion-tab>
    <ion-tab [root]="tab4Root" tabTitle="Inbox " tabIcon="chatbubbles"></ion-tab>
</ion-tabs>

TS

@Page({
  templateUrl: 'build/pages/tabs/tabs.html'
})
export class TabsPage {
  tab1Root: any = InvitePage;
  tab2Root: any = InfoPage;
  tab3Root: any = GalleryPage;
  tab4Root: any = InboxPage;

  competitionRunning: boolean = true;

  constructor(private userState : SystemUserState, private appState : ApplicationInfoState){
      // find the user's university
      var university = appState.findUniversity(userState.universityId);
      this.competitionRunning = university.Competition.IsRunning;
  }
}

Screenshot:
capture

Ionic Version: 2.x

Browser & Operating System: iOS / Android / Chrome

Run ionic info from terminal/cmd prompt:

Cordova CLI: 6.0.0
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.19
Ionic App Lib Version: 2.0.0-beta.9
OS:
Node Version: v5.7.0
@guillenotfound
Copy link
Contributor

I think this is a know issue (:

It has also been reported to Angular here: angular/angular#5363

@jgw96 jgw96 added the tabs label Mar 11, 2016
@brandyscarney brandyscarney added this to the 2.0.0-beta.5 milestone Apr 2, 2016
@brandyscarney brandyscarney self-assigned this Apr 2, 2016
adamdbradley added a commit that referenced this issue Apr 15, 2016
@adamdbradley
Copy link
Contributor

Instead of using *ngIf, we've added show to <ion-tab> to cover this scenario. It sets if the tab button is visible within the tabbar or not.

Additionally, we also added enabled.

If the tab is enabled or not. If the tab is not enabled then the tab button will still show, however, the button will appear grayed out and will not be clickable.

@captjones
Copy link

You can change the tab order using just CSS.

.tabs-icon-top > .tabs .tab-item:nth-of-type(1) { order:1; }

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 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 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants