0

I have hard time to refresh parent page on close popup. As a workaround I am doing window.location.reload() But I don't want to hard refresh the page. Just want to call ngOninit of parent page where I am binding the data to dx-datagrid. This popup is just adding a row in the grid so on close popup I want to refresh the list.

Mukesh
  • 53
  • 6

1 Answers1

0

I would suggest you to call a function in ngOninit instead of calling ngOninit from somewhere and call that function whenever the modal-popup is closed.

If the modal-popup is a child of your parent component, you can use an eventEmitter to send the event to parent whenever the modal-popup is closed and perform necessary actions in the parent.

If such is not the case, you can use a BehaviorSubject in a service, and change the BehaviorSubject's value when the modal-popup is closed. Because of it's reactive nature, same will be updated on parent as well and the necessary action can be performed accordingly (In the subscribe() of the BehaviorSubject).

Harshit T
  • 786
  • 4
  • 11