I'm trying to open my webcomponent in a new window (through a button click in an Angular app). The one that gets the closest to my desired result is this approach:
openPopup(): void {
const popup = window.open('', '_blank', 'width=50');
const component = document.createElement('component');
popup.document.body.appendChild(component);
}
Note that I'm creating the element inside document and not in popup.document. This works, however, the svg images are not loaded correctly, probably because it created it in the other document..
Versus creating the element in the popup.document
openPopup(): void {
const popup = window.open('', '_blank', 'width=50');
const component = popup.document.createElement('component');
popup.document.body.appendChild(component);
}
This last approach seems to be the one fitting the best but it simply does not give any HTML output except the HTML tag component. So it does not recognize the component for some reason in a new window.
What can I do?