Skip to content

Bug/Feat: Make tabs Condidtional #6637

Closed
@idesignpixels

Description

@idesignpixels

Short description of the problem:

In Ionic 2 beta7 and previous.
Tabs template does not work using ngIf or ngSwitch conditions.
It only works when adding a tab but does not remove a tab when condition is false.
If the condition is met more than once multiple instances of the same tab are rendered in the dom.

Steps to reproduce:

  1. Start tabs project
  2. add ngSwitch/ngIf to tabs template

For example

<ion-tabs tabbarPlacement="bottom" [ngSwitch]="userData.profileRole">
  <ion-tab tabIcon="home" [root]="home"></ion-tab>
  <ion-tab tabIcon="bookmark" [root]="bookmarks"></ion-tab>
  <ion-tab *ngSwitchWhen="'staff'" tabIcon="lock" [root]="admin"></ion-tab>
  <ion-tab tabIcon="settings" [root]="settings"></ion-tab>
</ion-tabs>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions