0

In my DoBootstrap, I setup the Angular element with

    const webComponentTag = 'ui-button'
    customElements.define(webComponentTag,  createCustomElement(UIButtonComponent, {injector}));

Note there is no way to remove a definition from registered custom elements.

If I serve with --hmr, I will get this error during reload: enter image description here

Vimal Patel
  • 2,785
  • 2
  • 24
  • 38
Yiping
  • 971
  • 10
  • 31

1 Answers1

1

You can add a condition to check if the element already has already been defined.

if (!customElements.get('ui-button')) {
  const webComponentTag = 'ui-button'
  customElements.define(webComponentTag,  
  createCustomElement(UIButtonComponent, {injector}));
}
Mr. Stash
  • 2,940
  • 3
  • 10
  • 24