ng-bind-html插入文本而不是实际元素

时间:2018-01-26 19:01:09

标签: angularjs

我的HTML:

<div ng-if="vm.activePost.domain === 'gfycat.com'">
    <div ng-bind-html="vm.gfycatEmbed()"></div>
</div>

控制器:

  gfycatEmbed(){
    return this.$sce.trustAsHtml(this.activePost.media.oembed.html);
  }

传递给trustAsHtml的字符串就是这个:

enter image description here

输出是这样的:

enter image description here

我的生活不能弄清楚我错过了什么。

我包括&#39; ngSanitize&#39;顺便说一句。

0 个答案:

没有答案
相关问题