How to programatically change tabs from outside of the tabview


#1

Currently I have a problem changing tabs from outside the tabview. In my app there are two tabs, a list view and a map view of the same items. When clicking on one of those items, a detailpage pops up with detailed information about the item. The detailpage is simply pushed on the navstack and popped. However when opening the detailpage from the listview, I want to display a button, “view on map”, which opens the mappage centered on the selected location. Currently I’m just pushing the mappage on top of the detailpage. However, this breaks the navbar back button and creates the possibility for an infinite loop of pushing pages on top of eachother.
So what I want to accomplish is popping the detailpage and then switching to the other tab, (with params). However, I don’t seem able to use

export class DetailPage {
    @ViewChild('baseTabs') tabRef: Tabs;

    private openMapPage() {
        // this.navCtrl.push(MapPage, {viewSingleLocation: true, locationFeature: this.locationDetails})
        this.navCtrl.pop();
        this.tabRef.select(1) // TODO: add params
    }

}

in my detailpage even though my ion-tabs is defined als #baseTabs. “this.tabRef is undefined”. I’m guessing this is because the detailpage cannot reach the tabs.
Is there any way to accomplish what I’m doing?