html - Angular way to set Iframe src to base64 data -
i trying set iframe source base64 data contains pdf in following format,
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>
error
blocked loading resource url not allowed $scedelegate policy.
you can go through doc of strict contextual escaping doc
but recommend inject $sce
, file path provided change to
$scope.reportbase64string=$sce.trustasresourceurl('data:application/pdf;base64,' + response.data);
Comments
Post a Comment