How run angular application inside shdow dom?
code:
<script type="text/javascript">
customElements.define('show-hello', class extends HTMLElement {
connectedCallback() {
const shadow = this.attachShadow({mode: 'closed'});
shadow.innerHTML = `
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="http://domain/styles.5b06983da863c73ff6ae.css">
<app-root></app-root>
`;
var tag = document.createElement('script');
tag.src = "http://domain/runtime.c5b03efbbe032268e2db.js";
tag.defer = true;
shadow.append(tag);
tag = document.createElement('script');
tag.src = "http://domain/polyfills-es5.1a4928232678b73b212e.js";
tag.nomodule = true;
tag.defer = true;
shadow.append(tag);
tag = document.createElement('script');
tag.src = "http://domain/polyfills.5d56ab2a8a4492384195.js";
tag.defer = true;
shadow.append(tag)
tag = document.createElement('script');
tag.src = "http://domain/scripts.cb9c1c75fdd88cce0ad3.js";
tag.defer = true;
shadow.append(tag)
tag = document.createElement('script');
tag.src = "http://domain/main.8120316e488535e5c9fe.js";
tag.defer = true;
shadow.append(tag)
console.log(shadow.innerHTML);
}
});
</script>
<show-hello></show-hello>
error:
ERROR Error: The selector "app-root" did not match any elements
at t.selectRootElement (main.8120316e488535e5c9fe.js:1)
at t.selectRootElement (main.8120316e488535e5c9fe.js:1)
at main.8120316e488535e5c9fe.js:1
at e.create (main.8120316e488535e5c9fe.js:1)
at t.bootstrap (main.8120316e488535e5c9fe.js:1)
at main.8120316e488535e5c9fe.js:1
at Array.forEach (<anonymous>)
at t._moduleDoBootstrap (main.8120316e488535e5c9fe.js:1)
at main.8120316e488535e5c9fe.js:1
at e.invoke (polyfills.5d56ab2a8a4492384195.js:1)
If this is not possible, maybe there is some other way to embed the application into the site so that the application styles do not mix with the site styles?
