4

Trying to compile a component using @angular/elements. Seems NgElement always extends HTMLElement. But I would like to extend HTMLButtonElement instead. Been looking at the createCustomElement's strategyFactory option, but cannot see where I can customize it.

Registering component like this:

const buttonComponent = createCustomElement(ButtonComponent, { injector } );
customElements.define('my-button', buttonComponent, { extends: 'button' });

Running this code throws the exception

Uncaught TypeError: Illegal constructor: localName does not match the HTML element interface

Which is expected as NgElement always extends HMTLElement, anyone know a way to extend the HTMLButtonElement instead?

0 Answers0