Angular 2 - 清理HTML

时间:2016-12-18 12:49:03

标签: angular sanitization

我迫切希望消除角度的消毒:(“警告:消毒HTML剥离了一些内容”。

我想要的只是在ngfor循环中显示在angular2中以json结束的div。凭借角度的doku,我很遗憾地作为初学者不知所措,我无法找到循环的例子。

这里是template-html的一部分 - 我试图用innerHTML掩盖它:

  <div class="col-sm-3 col-md-3" *ngFor="let item of _Interface; let i = index">
    <div [innerHTML]="item.timeline"></div>

但是Angular只向我展示了div的文字。

json / timeline元素的数据包含像这样的div

 "timeline": "<div class=\"timeline\"><span style = \"width: 10%; height: 3px; background - color:#376635; display:inline-block;\" ></ span >< span style=\"width:90%; height:3px; background-color:#d9d9d4; display:inline-block;\" ></span></div>",

0 个答案:

没有答案