Angular elements error . "Failed to construct 'HTMLElement …'

こ雲淡風輕ζ 提交于 2019-12-22 06:16:06

问题


I am trying out a very simple application on angular elements on stackblitz and I am getting the following issue.

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

All I am trying to do is trying to display hello world. I didn't face any issue doing this on visual code locally, however, this issue comes up on stackblitz. Not sure I have to follow some additional steps on stackblitz in order for me to run this application. Appreciate any help on this.

Here is the link to the application on stackblitz.


回答1:


Downgrade document-register-element to v1.8.1 solved it.

npm i document-register-element@1.8.1

Work for me.

Cr. https://github.com/angular/angular/issues/24390#issuecomment-396729418




回答2:


For anyone having this issue, just change the target to es6 or es2015 in your tsconfig.json file. That will work perfectly.



来源:https://stackoverflow.com/questions/50553449/angular-elements-error-failed-to-construct-htmlelement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!