3

I'm trying to create Ionic-3 Tab option, it's working fine, but my issue is I don't want to display 1st tab in tab menu,but I want to display 1st tab menu in page details in 1st time page opening ,I'm try to hide this 1st tab , but its not working for me, anyone knows how to do that?I have attached some images on my issue to help you understand it.

image

Tabs.html

<ion-tabs>
  <ion-tab [root]="tab0Root"></ion-tab>
  <ion-tab [root]="tab1Root" tabTitle="Check-In" tabIcon="people"></ion-tab>
  <ion-tab [root]="tab2Root" tabTitle="Observations" tabIcon="information-circle"></ion-tab>
  <ion-tab [root]="tab3Root" tabTitle="Activities" tabIcon="book"></ion-tab>
  <ion-tab [root]="tab4Root" tabTitle="Health" tabIcon="medkit"></ion-tab>
</ion-tabs>

Tabs.ts

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

import { AboutPage } from '../about/about';
import { ContactPage } from '../contact/contact';
import { HomePage } from '../home/home';
import {HealthPage} from '../health/health';
import {MainPage} from '../main/main';


@Component({
  templateUrl: 'tabs.html'
})
export class TabsPage {
  tab0Root = MainPage;
  tab1Root = HomePage;
  tab2Root = AboutPage;
  tab3Root = ContactPage;
  tab4Root = HealthPage;
  constructor() {

  }
}
UserID0908
  • 98
  • 1
  • 15
core114
  • 5,155
  • 16
  • 92
  • 189

2 Answers2

1

Every Tab has it own show property. So just change it to false if you want to hide it.
In tabs.ts:

import { Component, ViewChild } from '@angular/core';
import { Tabs } from 'ionic-angular';
@ViewChild(Tabs) tabs: Tabs;
ionViewDidEnter(){ 
    this.tabs.getByIndex(0).show = false; 
}
Duannx
  • 7,501
  • 1
  • 26
  • 59
0

code side:

tab0Root = MainPage;
public isVisibleFirstTab : boolean = false;

mark-up:

<ion-tab *ngIf="isVisibleFirstTab" [root]="tab0Root"></ion-tab>

or [rootParams] could be used for *ngIf condition

Berk Akkerman
  • 483
  • 1
  • 3
  • 12
  • Sir Now Im try it, not work, 1st Tab menu is hide but not display in that tab menu details is page opening, – core114 Jan 02 '18 at 06:27
  • this is my code `export class TabsPage { tab0Root = MainPage; tab1Root = HomePage; tab2Root = AboutPage; tab3Root = ContactPage; tab4Root = HealthPage; public isVisibleFirstTab : boolean = false; constructor() { }` – core114 Jan 02 '18 at 06:28