# Refresh HomePage After Modal Is Closed

**URL:** <https://forum.ionicframework.com/t/refresh-homepage-after-modal-is-closed/171020>\
**Category:** Ionic Framework\
**Created:** [August 12, 2019, 4:11pm UTC](https://forum.ionicframework.com/t/refresh-homepage-after-modal-is-closed/171020 "2019-08-12T16:11:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jefredallan](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jefredallan](https://forum.ionicframework.com/u/jefredallan)\
**Post date:** [August 12, 2019, 4:11pm UTC](https://forum.ionicframework.com/t/refresh-homepage-after-modal-is-closed/171020/1 "2019-08-12T16:11:43Z")

</div>

I have a homepage and a comment page. When I close the modal (comment page) , I want the homepage to refresh so that It can update the Comment Counts. I can refresh the homepage by calling `ionViewWillEnter()` function.

My code:  
homepage

```auto
    async openModal() {
      const modal = await this.modalController.create({
        component: CommentsPage,
        componentProps: {
          postId: this.postID
        }
      });

      modal.onDidDismiss(() => { this.ionViewWillEnter(); }); //Error: Expected 0 arguments, but got 1.ts(2554)

      return await modal.present();
    }

```

Comment Page:

```auto
  async closeModal() {
  this.modalController.dismiss();
  }

```

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [August 12, 2019, 5:19pm UTC](https://forum.ionicframework.com/t/refresh-homepage-after-modal-is-closed/171020/2 "2019-08-12T17:19:10Z")

</div>

If u change the data in the ondismiss handler angular will update your view

Calling ionViewWillEnter is never a good idea nor thinking in terms of a page refresh as an explicit action (in an angular project)

> [@\[Ionic 4\] How to update a list of elements after returning from modal](https://forum.ionicframework.com/t/ionic-4-how-to-update-a-list-of-elements-after-returning-from-modal/170713/6):
>
> Witch is the best practices: to update the data directly in the modal or to returning to paren page and calling the service from there? Thank you in advance slight_smile
