We have a modal which contains a component which has richtexteditor and ejs-mention components inside it. When modal is opened , the component containing richtexteditor is rendered. with this few divs with rte classes are added to the dom outside of the angular app-root selector like below :

After editing the richtexteditor and adding some mnetions with @ and #, when modal is closed, above divs are not removed from dom even if the component containing richtexteditor and ejs-metion is completely destroyed.
Because of the above we are getting a tabloid structure showing hex code at the bottom of the page.

This is not happening every time. Please suggest a solution for this.