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/Feat: Make tabs Condidtional #6637

Closed
idesignpixels opened this issue May 24, 2016 · 4 comments
Closed

Bug/Feat: Make tabs Condidtional #6637

idesignpixels opened this issue May 24, 2016 · 4 comments
Milestone

Comments

@idesignpixels
Copy link

idesignpixels commented May 24, 2016

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>
@Ionitron Ionitron added the v2 label May 24, 2016
@VR-Architect
Copy link

Up vote for this bug or feature. For line-of-business applications, use of dynamically added tabs is key. We show/hide based upon permissions areas of a record.

@jgw96 jgw96 added the feature label May 24, 2016
@dylanvdmerwe
Copy link
Contributor

Please see: #5768

This can be accomplished using the show input property on each tab. http://ionicframework.com/docs/v2/api/components/tabs/Tab/#input-properties

@idesignpixels
Copy link
Author

idesignpixels commented May 25, 2016

Although this is a reasonable ui fix this isn't removing it from the dom but merely hiding it from the user.
Someone can select it from the dom, remove the hidden attribute on the tab and then click it navigating to a page not meant for them.
This is not the solution.

@brandyscarney brandyscarney added this to the 2.0.0-beta.8 milestone May 25, 2016
@adamdbradley
Copy link
Contributor

@Lindstrom1989 Using the show input property would be the correct solution. Not having it in the DOM shouldn't matter, and if someone is hacking the DOM to view pages they shouldn't see, those pages should have the correct security on them if it's an issue.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 8, 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