Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Failed to construct 'HTMLElement': Please use the 'new' operator #5
the example works, but when I try to apply that to my component, it keeps throwing these errors on
Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
Does this happen in the example app or in your own?
This error means, that you need a polyfill for browser that do support (!) Custom Elements. That sounds a bit strange, but Custom Elements are defined for EcmaScript 2015+ (bases upon classes) and for supporting older browser, we normally compile down to EcmaScript 5 today.
Normally, I'm loading this polyfill:
And then, I'm referencing it in the angular.json:
To support browsers that DO NOT know Custom Elements, I'm also referencing another polyfill of this package in the polyfills.ts: