【发布时间】:2014-02-02 13:02:54
【问题描述】:
我尝试使用 ng-bind-html jsfiddel。 它似乎不适用于 youtube embed,为什么?
<div ng-app="App1">
<div ng-app="App1" ng-controller="Ctrl">
<div ng-bind-html="youtube">
</div>
<p>this is a youtube {{youtube}}</p>
</div>
</div>
脚本
var myApp = angular.module('App1', ['ngSanitize']);
myApp.controller('Ctrl', ['$scope', function($scope){
$scope.youtube = '<iframe width="560" height="315" src="//www.youtube.com/embed/FZSjvWtUxYk" frameborder="0" allowfullscreen></iframe>';
}]);
编辑:最初我的示例被简化为仅添加一个链接,感谢 IvorG,我注意到我没有添加“ngSanitize”作为依赖项,在添加依赖项后我编辑了问题以反映我遇到的原始问题: 添加 youtube 嵌入。
【问题讨论】:
标签: angularjs