问题描述
根据 this tutorial,我们需要将 tsconfig.json
编译器选项 allowJs
设置为 true
并包含 CUSTOM_ELEMENTS_SCHEMA
,我已经完成了这两件事,如图所示在这次 Stackblitz 中:
https://stackblitz.com/edit/angular-web-component-stripping
我还在此处使用最新的 Angular 版本创建了一个最小的复制品:
https://github.com/fireflysemantics/scully-custom-element-test
在 Stackblitz 演示中,innerHTML
组件的 hello
设置为:
<h1> Web Component Test</h1>
<fs-image url="https://fireflysemantics.github.io/i/developer/instant-html-vscode.png"></fs-image>
然而,Angular 会剥离 fs-image
网络组件。我们需要做什么来包含它?
Angular 确实记录了这个警告:
警告:清理 HTML 删除了一些内容,请参阅 https://g.co/ng/security#xss
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)