Call data every time that user enters in a page (tab based routing)

Hi. I’m developing an app based on tab navigation.
ionic + stencil + typescript
I would like to make my api calls everytime that the user enters on a page but the page don’t recharge when user change tab page because of caching. there is an event that I can listen to do this operation? I need to have fresh data from api every time the user enters in tab pages.

Solution:
In the pare where I want to call the api each time the user enters the page, this code

@Listen('ionViewWillEnter')
listenIon() {
    this.userData = undefined;
    loadUserData(this.userId);
}

The ion-router-outlet has life cycle hooks - ion-router-outlet | Ionic Documentation.

An ion-route has navigation hooks - ion-route: API Route Component for Ionic Framework Apps.

1 Like