2016-05-19 6 views
0

私はError: $interpolate:interr Interpolation Errorに入っており、YouTube動画をiframeに動的に入れています。動的にiframe srcに角を付け加える方法

HTML

<div class="embed-responsive embed-responsive-16by9"> 
    <iframe class="embed-responsive-item" src="{{youtubeVideo}}" allowfullscreen></iframe> 
</div> 

私のデバッグ文が私に有効な値の安全のために

response 
script.js:129 Object {data: Object, status: 200, config: Object, statusText: ""} 
script.js:131 Youtube 
script.js:132 Object {data: Object, status: 200, config: Object, statusText: ""} 
script.js:134 Video Url 
script.js:135 https://www.youtube.com/watch?v=BRtj_TSOHjw 

答えて

0

を与えている

$http({ 
    method: 'GET', 
    url: getTankVideos(query) 
}).then(function successCallback(response) { 
    console.debug('response'); 
    console.debug(response); 

    $scope.youtube = response; 
    console.log('Youtube'); 
    console.log($scope.youtube); 

    console.log('Video Url'); 
    $scope.youtubeVideo = 'https://www.youtube.com/watch?v=' + $scope.youtube.data.items[0].id.videoId; 
    console.log($scope.youtubeVideo); 

}, function errorCallback(response) { 
    // called asynchronously if an error occurs 
    // or server returns response with an error status. 
}); 

角度Javascriptを/、あなたはコントローラに$sceサービスを注入する必要がありますtrustAsResourceUrlはそこにあるURLです。

$scope.youtubeVideo = $sce.trustAsResourceUrl('https://www.youtube.com/watch?v=' + $scope.youtube.data.items[0].id.videoId); 
+0

ありがとう、これは間違いなく – Programatic

関連する問題