相关疑难解决方法(0)

删除ng-bind-html-unsafe后,如何注入HTML?

我正在尝试使用$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,我得到这个错误:

http://errors.angularjs.org/undefined/$sce/unsafe

html angularjs

265
推荐指数
7
解决办法
24万
查看次数

新行'\n'在Typescript中不起作用

我在typescript组件中创建一个列表项,它将显示在UI中.列表项应以单独的行显示.所以我添加了新的字符串\n如下所示.但是列表项仍然显示在同一行中.下面是代码.知道为什么它不起作用吗?

UI列表的UI显示

打字稿代码:

@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)

html css html5 typescript

8
推荐指数
3
解决办法
3万
查看次数

标签 统计

html ×2

angularjs ×1

css ×1

html5 ×1

typescript ×1