我正在尝试使用$sanitizeprovider和ng-bind-htm-unsafe指令允许我的控制器将HTML注入DIV.
但是,我无法让它发挥作用.
<div ng-bind-html-unsafe="{{preview_data.preview.embed.html}}"></div>
Run Code Online (Sandbox Code Playgroud)
我发现它是因为它从AngularJS中删除了(谢谢).
但没有ng-bind-html-unsafe,我得到这个错误:
我在typescript组件中创建一个列表项,它将显示在UI中.列表项应以单独的行显示.所以我添加了新的字符串\n如下所示.但是列表项仍然显示在同一行中.下面是代码.知道为什么它不起作用吗?
打字稿代码:
@Output() excludeDisplay: any = '';
@Output() includeDisplay: any = '';
includeValues: any = '';
excludeValues: any = '';
this.includeValues += this.merId + ',' + this.explodeStatus + '\n';
console.log("include values are "+ this.includeValues);
this.excludeValues += this.merId + ',' + this.explodeStatus + '\n';
console.log("exclude values are "+ this.excludeValues);
this.includeDisplay = this.includeValues;
this.excludeDisplay = this.excludeValues;
Run Code Online (Sandbox Code Playgroud)
Html代码:
<ul id="excludedUl" required>{{ excludeDisplay }}</ul>
<ul id="includedUl" required>{{ includeDisplay }}</ul>
Run Code Online (Sandbox Code Playgroud)
CSS代码:
#includedUl {
float: right;
width: 33%;
}
#excludedUl {
float: right;
width: 33%;
}
Run Code Online (Sandbox Code Playgroud)