I'm using ngx-build-plus for compile element to js.
Error ERROR TypeError: can't access property "events", this.ngElementStrategy is undefined throw at line 512. And the break point is fired. But the point at line 481 isn't.
Offical repo: https://github.com/angular/elements-builds/blob/12.0.x/esm2015/src/create-custom-element.js#L55

For some reason,
createElementpasses HTML element you're creating asthisinside constructor ofNgElementImplinstead of instance ofNgElementImpl. And thisthisdoesn't haveNgElementImpl's methods or private / protected fields. The (ugly) solution would be moving allNgElementImplinternals outside of the class, into the enclosing function:create-custom-element.tsby moving implementation of instance methodsget ngElementStrategyImplandsubscribeToEventsoutside of the class.The version below is taken (and rewritten) from Angular 17.0.6 sources.
createCustomElementfrom this modifiedcreate-custom-element.tsinstead of importing it from Angular Elements.version.tsfrom copy-pasted Angular Elements sources.You might need to either add
"noImplicitAny": false,to yourtsconfig.app.json, or to further adjust the source code to avoid compilation errors. Also, consider adding/* eslint-disable */to the top of each copy-pasted Angular Elements files to avoid linter errors.The related bug in Angular repository was marked as fixed, but it still strikes back at you in Firefox 120 as of 2023-12-11.