Topic: How to refresh the list of parent component from the dynamic modal component
jayotirana asked 5 years ago
I have a dynamic modal component and I used this component in another component (like b component) via using mdbModalService. I am able to open the modal popup using mdbModalSerice. In this modal popup I want to raise an event once I am done with upload file functionality to the b component to call the refresh method to refresh the list of files.
// modal component ts
fileuploadFiles(orderItemId: string, files: File\[\]) { // After uploading file this.modalRef.hide(); // close the modal// How to refresh/call the method of parent component after closing modal popup this.refreshTaskDocuments.emit('Here is an Emit from the Child...'); }); }
How we can achieve this, any idea?
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- User: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.5.2
- Device: PC
- Browser: Chrome
- OS: Window
- Provided sample code: No
- Provided link: No
Damian Gemza staff commented 5 years ago
Dear @jayotirana
Please provide me with a description of your problem.
What exactly did you try? From this code snippet, I won't be able to help you well.
Best Regards,
Damian
jayotirana commented 5 years ago
@Damian Gemza , I updated the detail.
Thanks
Damian Gemza staff commented 5 years ago
Could you please provide me with the code of the components which holds dynamic modal and file upload? And also, the dynamic modal component too.
I would like to reproduce your problem on my side.
jayotirana commented 5 years ago
It's the same, I added in the same way that is explained here: https://mdbootstrap.com/docs/angular/modals/basic/ I want in the same way like https://stackblitz.com/edit/angular-j4rahu:
jayotirana commented 5 years ago
@Damian Gemza found the solution. I need to use the closed method in the component where I opened the modal component to track the close event like:
this.modalService.closed.subscribe((result: any) => { this.refreshList(); });