Hide tab from tabs!

I want to hide one tab from tabs , the admin can see 4 tabs but the user and the employee can see 3
(Role based authentication with Ionic & Firebase)
some help Please

<ion-tab-button tab="traveaux" >
  <ion-icon name="apps"></ion-icon>
  <ion-label>Traveaux</ion-label>
</ion-tab-button>

<ion-tab-button tab="personnels" *ngif="isAdmin">
  <ion-icon name="contacts"></ion-icon>
  <ion-label>personnels</ion-label>
</ion-tab-button>

<ion-tab-button tab="messages" >
  <ion-icon name="chatboxes"></ion-icon>
  <ion-label>Messages</ion-label>
</ion-tab-button>

<ion-tab-button tab="plus" >
  <ion-icon name="settings"></ion-icon>
  <ion-label>Plus</ion-label>
</ion-tab-button>

In your tabs.page.ts file:

import { Component, OnInit,  } from '@angular/core';

@Component({
  selector: 'app-tabs',
  templateUrl: 'tabs.page.html',
  styleUrls: ['tabs.page.scss']
})
export class TabsPage implements OnInit {
  isAdmin = false;
  constructor() { }

  ngOnInit() { }

}

The actual value would come from some service, and you might want to look at using a routeguard from your login page.

thank you sir , may I ask you how can I put ion-segment inside ion-input , and if I click for example segment 1 , I want to save it in firestore ?

ion-tab element has a show attribute, which you can use isAdmin class variable to toggle the tab of choice.

html

<ion-tab-button tab="traveaux">
  <ion-icon name="apps"></ion-icon>
  <ion-label>Traveaux</ion-label>
</ion-tab-button>

<ion-tab-button tab="personnels" [show]="isAdmin">
  <ion-icon name="contacts"></ion-icon>
  <ion-label>personnels</ion-label>
</ion-tab-button>

<ion-tab-button tab="messages" >
  <ion-icon name="chatboxes"></ion-icon>
  <ion-label>Messages</ion-label>
</ion-tab-button>

<ion-tab-button tab="plus" >
  <ion-icon name="settings"></ion-icon>
  <ion-label>Plus</ion-label>
</ion-tab-button>

and in tabs.page.ts ?

in my App 3 users (admin, employee , normalUser)

for example there is a button in tab1 I want just the admin and normalUser to be able to see it , how can I do thiis?

Le mar. 21 mai 2019 à 02:19, Neil via Ionic Forum ionicframework@discoursemail.com a écrit :