On button click navigate to the specific tab in another page

I have 2 pages, service.html & sevicetab.html. Data is fetched by api in both pages. When i click on one of the categories in the service.html page, i want the same category to be highlighted / selected in the servicetab.html page. Can someone please guide me to achieve this.


To be precise this pic shows what i am trying to achieve…

Which component did you use?
If you used ion-segment set value in ngModel for segments. If you used super-tabs, set selected index to the index you want to get selected.
try writing this logic in ionViewWillEnter()

I have used ion-segment

For ion-segment, set value of ion-segment ngModel in ionViewWillEnter.
for ex. in HTML

<ion-segment [(ngModel)]="segments">
  <ion-segment-button value="0">
    <ion-label>First</ion-label>
  </ion-segment-button>
  <ion-segment-button value="1">
    <ion-label>Second</ion-label>
  </ion-segment-button>
</ion-segment>

in TS file,

ionViewWillEnter() {
  this.segments = navParams.get('activeTab');
}

while navigating to page, send index in navParams.

goTo(index) {
  this.navCtrl.push(TabsPage, { activeTab : index });
}

How to do this on button click… as Service.html page has buttons

Implement this code on button click

this will be on tabs page

Work like a charm. Thank you very much…