1

I have looked into different examples of using angular 6 elements and found it quite impressive. All of them are describing approach when you just connect your custom component to AppModule (root module). I want to keep my custom components in a separate module (feature module). Every time I am trying to achieve this, I receive next error -

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

Does anyone know how to implement it in the separate module?
Thanks!

Adoratus
  • 55
  • 8
  • have you tried to navigating into the feature folder where you have the module that is not the root module? what is the command you are using to create the component – Patricio Vargas Jun 25 '18 at 16:15
  • `npm i document-register-element@1.8.1` was part of some tutorials and can be checked here: https://stackoverflow.com/questions/50553449/angular-elements-error-failed-to-construct-htmlelement – Akber Iqbal Mar 13 '19 at 12:21

1 Answers1

0

Try: "target":"es5" in the tsconfig.json to "target":"es2015". I had similar issue -- same error message, but not with features as you mentioned, with just using elements in general. What I did was update elements, to use the document-register-element.

Taranjit Kang
  • 2,510
  • 3
  • 20
  • 40