🐛 [Bug]:
Version
Angular Version
Angular: 12.2.16
Link to minimal reproduction
-
component.html <d-avatar [imgSrc]="headerImg">
-
component.ts headerImg; ngOnInit(): void { this._http.post(_api, { keyID: 2, }, { responseType: 'blob', }).subscribe((data) => { // const _blob = this._sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(data)); const _src = URL.createObjectURL(data); this.headerImg = _src; }); }
the headerImg cannot be displayed normally in d-avatar
Step to reproduce
-
component.html <d-avatar [imgSrc]="headerImg">
-
component.ts headerImg; ngOnInit(): void { this._http.post(_api, { keyID: 2, }, { responseType: 'blob', }).subscribe((data) => { // const _blob = this._sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(data)); const _src = URL.createObjectURL(data); this.headerImg = _src; }); }
the headerImg cannot be displayed normally in d-avatar
What is expected
No response
What is actually happening
No response
Any additional comments (optional)
No response
I tried it and it didn't happen again.your code should be this.headerImg= this._sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(data)); and make sure data is of type Blob. @kscSoft
demo
@kscSoft Thank you for your feedback. I hope the title of issue can be written clearly.