2016-08-08 7 views
0

は、フォーマットを以下にPDFが含まれ、アンギュラ方法

JS

$http.get('../../xyz', { token: $scope.token}) 
    .success(function(response) { 
     $scope.reportBase64String = 'data:application/pdf;base64,' + response.data; 
    }); 

HTML

<iframe id="report" ng-src="{{reportBase64String}}"></iframe> 

エラー

$ sceDelegateポリシーで許可されていないURLからのブロックされた読み込みリソース。

答えて

2

あなたが$sce を注入するDoc

今の私はあなたをお勧めしますエスケープ厳格な文脈のドキュメントを通過することができますし、

$scope.reportBase64String=$sce.trustAsResourceUrl('data:application/pdf;base64,' + response.data); 
に変更にそれを提供するファイルのパス