Unregister custom element

跟風遠走 提交于 2019-12-11 06:08:32

问题


Is it possible to unregister a custom element that has been created by createCustomElement?

We use Web Components to wrap out vertical features, all 'parts' of the feature are downloaded before the Web Component is added to the DOM.

What we would really like is to completely destroy the component when the feature is no longer active but there it looks like there is no API available.

Has anyone had any luck with this?


回答1:


At the Angular level, there doesn't seem to be any "destroy" or "remove" function alongside createCustomElement in @angular/elements.

At the DOM level, looking at the CustomElementRegistry interface, the interface provided by customElements, there is no "undefine" or similar to accompany define. (This may be part of why Angular doesn't have a "destroy" or "remove"...)

So I'd say: No, you can't remove it.



来源:https://stackoverflow.com/questions/53757396/unregister-custom-element

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