Reputation: 307
I have an Ionic project using tabs.
On my tab I have the following:
<ion-tab [root]="tab1Root" (ionSelect)="toggleCompare();" tabTitle="Compare"></ion-tab>
When I click this it correctly takes me back to the root page, and then runs my toggleCompare function, which is inside my tabs.ts...
constructor(public navCtrl: NavController, private _appGlobals: AppGlobals) {
this._appGlobals.showCompare.subscribe(value => this.compare = value);
}
toggleCompare() {
this.compare = !this.compare;
this._appGlobals.showCompare.next(this.compare);
}
Which again on click coming from another page works absolutely fine. The problem I have is that if you go to click the button again the page does absolutely nothing. No refresh, not running of the function.
Can anyone suggest a better way of toggling but also routing back to the page if the user is not already on it?
Any advice is very appreciated.
Upvotes: 1
Views: 149
Reputation: 307
So after some extensive digging I came to the conclusion that the ion-tabs were the blocker in achieving the result I desired. I ripped them out and made my own tabs using the side menu template provided by Ionic. This fixed my issue and now the tabs swap out dynamically.
Upvotes: 0