Reputation: 505
I've got a component that shows a list of items fetched from a service, well from a remote API. when you open the "add new item" modal and add a new item, and then OK button and closes this modal, no change in the list of items - the newly created item not seen on the list. also checked - ionViewWillEnter() not firing after closing the modal and inside ionViewWillEnter() is the fetching from db:
this.feedingService.fetchFeedingListByBabyIdFromAPI(this.babiesService.getChosenBabyID())
.subscribe((response) => {
this.feedings = response;
});
Upvotes: 2
Views: 1874
Reputation: 29614
You need to use ModalController
API onDidDismiss
.
await modal.onDidDismiss();
//call feedingServiceSubscribe to reload list
Or you can even return data from the modal using onDidDismiss and set in your list.
const item = await modal.onDidDismiss();
this.feedings.push(item);
Showing a modal does not really change the navigation stack. So dismissing the modal does not fire lifecycle events of the parent.
Upvotes: 1