Angular 2 Material工具提示,HTML内容为angular

问题描述 投票:5回答:1

我试图将HTML字符串绑定到角度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
1个回答
4
投票

对我们来说是坏消息:角度材料工具提示不支持HTML,目前,他们没有意图支持它。 Here更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.