私の HTML ページは次のようになります。
<div>
<iframe margin="0" padding="0" border="none" width="420" height="345" frameBorder="0"
ng-src="{{exercise_video_url}}">
</iframe>
</div>
'exercise_video_url' コントローラーで次のように設定しています。
$http.get("https://localhost:8000/api/exercises/initial/").then(function(response){
$scope.initial_data=response.data;
angular.forEach($scope.initial_data, function(item){
$scope.exercise_type=item.exercise_type;
$scope.exercise_description=item.description;
$scope.exercise_video_url=$sce.trustAsResourceUrl(item.video_url);
})
Django ビューから特定のエクササイズ関連の情報を取得しています。エクササイズ モデルには属性として video_url があります。私はどこかを読んで、角度コントローラーに $sce サービスを注入しました。
ビデオリンク自体は「 https://youtu.be/ ******」のように見えます--> * はいくつかのランダムな文字です。このリンクは、ブラウザでヒットするか、ソースとして ng-src に直接渡すと、独立して正常に機能します。
settings.py で「 django.middleware.clickjacking.XFrameOptionsMiddleware」 にもコメントしてみました