我有一个应用程序可以获取用户内容,例如博客内容,这些内容在服务器上保存为 HTML。
我需要渲染它,它可能有自定义指令,如
REST API RESPONSE SAMPLE:
content: "<div>
<span class="impressive-css-class">This is rendered perfectly by passing HTML to sanitizer.bypassSecurityTrustHtml</span>
and
<span spoiler>SpiderMan dies on Page 142: Rendered as HTML. Directive not processed (naturally)</span>
</div>"
我需要在这个动态返回的用户内容上呈现扰流板指令。
我从 SO 和广泛的搜索中了解到,一种方法是在构建过程中启用 JIT(无 AOT)(buildOptimizer:false,并在 polyfills.ts 中导入'core-js/es7/reflect',创建模块/组件动态使用 JIT)以很长的复杂方式(可能会在角度版本升级时中断)
有没有其他我不知道的动态呈现我的用例的方法?