How we refresh a page on back button

How i refresh a button whick i click on back button to come on previous page

2 Likes

Use the ionViewWillEnter() method in the “previous page”. This will trigger when the user enters (and also returns) to that page.

2 Likes

It’s not working.
I tried with ion-back-button

<ion-back-button></ion-back-button>

I also tried to use a custom button

<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-button (click)="changeRoute()">Back</ion-button>
    </ion-buttons>
    <ion-title>Reminder</ion-title>
  </ion-toolbar>
</ion-header>

And the route change function is as below

changeRoute() {
    this.router.navigate(['/home']);
}

But still, in the home page, none of the below methods are triggering.

ionViewWillEnter() {
    console.log('ionViewWillEnter')
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad')
  }
  ionViewWillLeave() {
    console.log('ionViewWillLeave')
  }
  ionViewDidLeave() {
    console.log('ionViewDidLeave')
  }
  ionViewWillUnload() {
    console.log('ionViewWillUnload')
  }
  ionViewDidEnter() {
    console.log('ionViewDidEnter');
  }

My ionic version info is as below

Any help would be appreciated.