Push pages using tabs - Ionic

I’ve got an app with 2 tabs. Each tab displays a page which contains a link to the next page. Let’s say:

Tab1: A1 --> A2

Tab2: B1 --> B2

Being in B2 I want to go to A2 and also on Tab1 If I click back being on A2 now, I want to move to A1.
Going again to Tab2 B1 should display

Resuming: after moving from B2 to A2 everything should be reset (except the possibility to move back from A2 to A1)

Can you define these terms:

  • transition
  • redirected

See:

Try posting some sample code:

app.component.ts:

  public rootPage: any = 'TabsPage'; 

tabs.page.html:

<ion-tabs #tabs selectedIndex="2" (ionChange)="ionTabChanged($event)">
  <ion-tab [root]="tab0Root" tabUrlPath="activity-tab" tabIcon="fa-fal-list"></ion-tab>
  <ion-tab [root]="tab1Root" tabUrlPath="location-tab" tabIcon="fa-fal-map-marker"></ion-tab>
  <ion-tab [root]="tab2Root" tabUrlPath="search-tab" tabIcon="fa-fal-street-view"></ion-tab>
  <ion-tab [root]="tab3Root" tabUrlPath="person-tab" tabIcon="fa-fal-user"></ion-tab>
  <ion-tab [root]="tab4Root" tabUrlPath="notifications-tab" tabIcon="fa-fal-bell"></ion-tab>
</ion-tabs>

tabs.page.ts

export class TabsPage implements OnInit, OnDestroy {

  @ViewChild('tabs') private tabsRef: Tabs;

  public tab0Root = 'ActivityPage';
  public tab1Root = 'LocationPage';
  public tab2Root = 'SearchPage';
  public tab3Root = 'UserPage';
  public tab4Root = 'NotificationsPage';

  ...

}

search.page.ts:

  ...

  public openPage(item: any) {
    this.navCtrl.push(item.component);
  }

  ...

Updated my question.

Thanks for your response but that’s a normal tab. I think for my specific scenario no code is needed, it’s more related with the behaviour itself, how to manage these links.

My idea (if this sounds more understandable) is when I move from one tab to another tab (with a specific link i.e.) I want to lose the history so if I click back (dismiss) being on A2 I want to go back to A1, not to the REAL previous page, which would be B2.

Also the other thing when I click on this link is display the Tab1, not Tab2.

On your example, if you have a link to ActivityPage in LocationPage when you click this you’ll display first page but you’ll still inside LocationPage tab.

any ideas?
:grinning: