ng-devui icon indicating copy to clipboard operation
ng-devui copied to clipboard

🐛 [Bug]:

Open kscSoft opened this issue 3 years ago • 2 comments

Version

[email protected]

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

kscSoft avatar Sep 24 '22 03:09 kscSoft

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

EnochGao avatar Sep 27 '22 07:09 EnochGao

@kscSoft Thank you for your feedback. I hope the title of issue can be written clearly.

kagol avatar Oct 21 '22 03:10 kagol