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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -