In my application, there are 4 tabs, each displaying different data based on a specific configuration. The header of the page includes a popover component with settings options. When a user adjusts the settings and returns to a tab page, the content on that page should refresh.
I have tried using the ionViewDidEnter or ionViewWillEnter lifecycle events to detect if the settings have changed upon returning to the tab page. However, I noticed that these events only trigger when switching between different tab pages.
For Tab Page A:
export class HomePage implements OnInit {
ionViewDidEnter(){
if(this.client.doClientChanged(this.clientName)){
console.log("changed");
}
else{
console.log("not changed");
}
}
ionViewWillEnter(){
console.log("test")
}
}
Header Component:
export class PrimeHeaderComponent {
constructor(public popoverCtrl: PopoverController) {}
presentPopover(event: any) {
let popover = this.popoverCtrl.create(MenuPage);
popover.present({
ev: event
});
}
}
Popover Component:
export class MenuPage {
constructor(
public viewCtrl: ViewController, private navCtrl: NavController) {}
openConfig(){
this.navCtrl.push(ConfigPage);
}
}
After selecting a configuration and returning to the previous page with the popover displayed, dismissing the popover does not trigger any lifecycle events.