Tabs not working after using select

#1

Hi,
I’m using select method to change the tab from ts file.
and its working,

The problem is, after using select.
this.tabRef.select(0,{});

Tabs not working,
Pls help.
Thanks

#2

I fixed this and its working

#3

Hello,
congrats.

Post solution, this will maybe help somebody else.

Best regards

#4

Oh sorry,

This is the resolved code :
<ion-tabs #myTabs tabsPlacement=“bottom” (ionChange)=“tabSelected($event, false)” (tap)=“undefindTab($event, true)”>

undefindTab(tab, type){
if(this.sameTab){
if(this.tabIndex == 2 && this.count == 1){
this.switchToHomePage();
this.icon = ‘md-add’;
this.tabIndex = 0;
this.count = 0;
this.sameTab = false;
}
}
}

tabSelected(tab, type) {
let index;
if(tab.index == 2){
if(this.count == 1){
this.switchToHomePage();
this.icon = ‘md-add’;
this.tabIndex = 0;
this.count = 0;
this.sameTab = false;
}else{
if(tab.index != undefined){
this.count +=1;
this.tabIndex = 2;
this.icon = ‘md-close’;
this.sameTab = true;
}
}
}else{
this.tabIndex = null;
}
if(tab.index > 0 && tab.index != 2){
index = tab.index;
}else{
index = null;
}
if(index != null){
this.switchToHomePage(index);
}
}

switchToHomePage(index?:number){
let _index = index ? index : 0;
setTimeout(() => {
this.tabRef.select(_index);
}, 10);
}

Thanks.