【发布时间】:2017-10-25 22:38:42
【问题描述】:
我正在尝试将 HTML 字符串绑定到 angular 2 工具提示中。但它呈现为 HTML,它显示为纯字符串。有没有办法将字符串呈现为 HTML。
这是我的代码:
在视图中:
<span class="icon-status" mdTooltip="{{value.status}}"></span>
组件:
value.status = this.sanitizer.bypassSecurityTrustHtml(this.getStatusTemplate(value.status));
getStatusTemplate(status: IIconStatus): string{
let HTML =`
<div>Event Title</div>
<div class="">
<table>
<thead>
<th>User</th>
<th>User</th>
<th>User</th>
<th>User</th>
</thead>
</table>
</div>
`;
return HTML;}
提前致谢。
【问题讨论】:
标签: javascript html angular