Html:
<div class="video-container" ng-bind-html="mediaIframe"></div>
Javascript:
if($scope.post.uuid.substr(0, 3) == 'ut_') {
var videoWidth = bodyWidth - 20;
var videoUrl = 'http://www.youtube.com/embed/'+$scope.post.uuid.substr(3)+'?rel=0';
$scope.mediaIframe = '<iframe width="'+videoWidth+'" height="200" src="'+$sce.trustAsResourceUrl(videoUrl)+'" frameborder="0" allowfullscreen> </iframe>';
console.log($scope.mediaIframe);
} else {
$scope.mediaIframe = "";
}
It ends up only with an empty div. The console goes OK:
<iframe width="300" height="200" src="http://www.youtube.com/embed/BjJpNFRHxKg?rel=0" frameborder="0" allowfullscreen> </iframe>