Router back to tabs not refreshing child tab IONIC

Viewed 476

Im using ionic 5.4.16 and in my software is using the basic ionic tab functionality.

Issue: When navigating back from a page to the tab functionality, the information inside is not been refreshed.

Tried:I'm trying to use the ionViewWillEnter and ionViewDidEnter, but the issue is that this methods are not been trigger from the tab1, the methods of its father tabs are calling those methods, but i cannot refresh my tab1 information directly from the tabs. If i route directly to the page ('/Home'), without using the tabs it work well ,but this is not the objective since i need to see the tabs menu.

Code:

HomePage (tab1) have a customized component that once clicked navigate to ap-details page

//TAB1 customized component     
private gotoItemDetails()
      {
        let navigationExtras: NavigationExtras = {
          state: {
            AP_ITEM: this.data,
            balance: this.balance
          }
        }
        this.router.navigateByUrl('ap-details',navigationExtras);
      }

On ap-details, once user submits, the transaction is commited and I navigate back to tab1 (that have Home), debtfromAccountAndGetNewAP commit the information on the DB and also update localstorage info

//AP-Details page, not part of tabs
      sendTranscation()
  {
    console.log("send trasnaction");
    this.accountServices.debtfromAccountAndGetNewAP(this.AP_ITEM,this.pendingTransaction).subscribe((res) => {
      //alert("sent !");
      this.router.initialNavigation();
      this.router.navigateByUrl('/tabs/tab1');
    });

Home informataion is not refreshed, neither the methods inside are called

  ionViewWillEnter() {
this.refreshPage();
console.log(" on view will ender");

}

ionViewDidEnter() {
  console.log(" on view did enter");
}

ionViewWillLeave() {
  console.log(" on view will leave");
}

ionViewDidLeave() {
  console.log(" on view did leave");
}
ionTabsWillChange()
{
  console.log(" on tab did change1");
}

What im doing wrong?

0 Answers
Related