How to close page when I navigate between tabs?


When I’m in tab 1, I can open page when I click on an item in a list-items but I’d like this page be closed when I come back on tab 1 from tab 2 for example. For the moment, I go to a page from tab 1, the page is still open when I come from another tab.

My problem is I don’t manage to close page when I navigate between tabs. I tried to a add a click function in the tab.html file to close open pages but nothing happens (even a console.log). I can’t call a function from here so I don’t know where to write the code.

<ion-tabs [color]="'primary'">
  <ion-tab [root]="tab1Root" tabTitle="" tabIcon="stats"></ion-tab>
  <ion-tab [root]="tab2Root" tabTitle="" tabIcon="home"></ion-tab>
  <ion-tab [root]="tab3Root" tabTitle="" tabIcon="restaurant"></ion-tab>
  <ion-tab [root]="tab4Root" tabTitle="" tabIcon="map"></ion-tab>
  <ion-tab [root]="tab5Root" tabTitle="" tabIcon="cart"></ion-tab>