My Angular app has a peculiar issue. In one component, my HTML includes a selector of another component within a div like this:
<div id="header">
<selector>
Text Content
</selector>
</div>
When I try to clone this div in my Typescript using the following code:
var headerClone = document.getElementById('header').cloneNode(true);
The resulting headerClone does not include the <selector>
tag as expected. Instead, it looks like this when logged in the console:
<div _ngcontent-ikv-c2 class id="header">Text Content</div>
This absence of the <selector>
tag is causing issues with the loading of HTML/CSS for the selector component. How can I ensure that the clone includes the <selector>
tag properly?