We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

dialog not removed from DOM view after destroying the component which is created on-fly(dynamic components) using component Factory Resolver

Hi,

screen1 showing that dynamic component which is containing ejs-dialog is created on fly:


Dynamic component (html part):


browser console part which showing repeatedly adding ejs-dialog part:


Why i am trying this:
We required a confirmation box through out the application.So i am creating a component which contains ejs-dialog on fly using component resolver and destroying after
closing it.For any component other than dialog is removed from DOM ,or atleast not appending to DOM.

Thank you.


3 Replies

NP Narayanasamy Panneer Selvam Syncfusion Team August 7, 2019 02:05 AM UTC

Hi Goutham, 
 
Greetings from Syncfusion support. 
 
We have validated the issue with shared code block and we able to reproduce the reported issue. Dialog element not destroyed properly while use routing and dynamic component render approach and this information specified in our document. 
So, we suggest you to manually remove the dialog target element by using id selector to find element from DOM. 
Sample code: 
html 
<ejs-dialog id="dynamicDlg"> 
</ejs-dialog> 
 
TS: 
let dlgEle: any = document.getElementById("dynamicDlg"); 
dlgEle && dlgEle.remove(); 
 
 
For your convenience we have prepared a sample, please get it from the below link. 
 
Regards, 
Narayanasamy P. 



GO Goutham August 7, 2019 06:58 AM UTC

Thank you very much,Now its working as expected.


NP Narayanasamy Panneer Selvam Syncfusion Team August 7, 2019 07:09 AM UTC

Hi Goutham, 
 
We are glad to here that the suggested solution resolved your issue. 😊 
 
Regards, 
Narayanasamy P. 


Loader.
Live Chat Icon For mobile
Up arrow icon