If: <img id="bigPicture" [src]='sanimg'/>
http://localhost:8100/null 404 (Not Found)
If: <img id="bigPicture" src='{{sanimg}}'/>
I read somewhere that this bining should not use if variable is non-text
Error is: unsafe:SafeValue must use [property]=binding: blob:http://localhost:8100/8e5c1cc6-d784-4844-b0d3-e9d16732d114 (see http://g.co/ng/security#xss):1 GET unsafe:SafeValue must use [property]=binding: blob:http://localhost:8100/8e5c1cc6-d784-4844-b0d3-e9d16732d114 (see http://g.co/ng/security net::ERR_UNKNOWN_URL_SCHEME
That should be safely ignorable and resolve itself once the http request has come back. If you wish, you can fence the image off with *ngIf or fill sanimg with a safe dummy placeholder URL in an initializer.
I know this problem is not related to ionic but Angular. However I am hoping to get it worked.
I have used the code and I am able to get response and set it into "sanimg"
However, browser not able to render the image.
I am getting like HTML like
<img id="bigPicture" src="����JFIF ..." >
I am using dropbox api and content-type is application/octet-stream .
I tried converting response into blob
.map(res => {
return new Blob([res['_body']], {
type: 'application/jpeg'
});
})
.map(blob => {
var urlCreator = window.URL;
return this.sanitizer.bypassSecurityTrustUrl(urlCreator.createObjectURL(blob));
})
In final html Code: no object preview in generated URL, chrome developer tool -> network tab
<img id="bigPicture" src="blob:http://localhost:8100/fe6bce7b-106f-4b84-8c9f-a7628cdaf3a4">