【发布时间】:2018-07-30 11:16:24
【问题描述】:
当我通过角度插值分配一些 html 标签(如按钮)或自定义标签时插值问题,然后它没有显示
在component.html文件中
<div [innerHTML]="html"></div>
在component.ts文件中
html = "<h1>Header</h1> <button>Button</button>"
不工作在角度 https://stackblitz.com/edit/angular-j5gsb4?embed=1&file=app/app.component.ts
它在纯 html/js 中工作 https://plnkr.co/edit/3PWexJjKbOEe50egKjqJ?p=preview
【问题讨论】:
-
在链接的问题中,请参阅我在 stackoverflow.com/a/41089093/217408 的回答,该回答演示了消毒剂。
标签: javascript html angular