<ngx-dropzone-image-preview ngProjectAs="ngx-dropzone-preview" *ngFor="let f of files" [file]="f" [removable]="true" (removed)="onRemove(f)">
</ngx-dropzone-image-preview>
如果还想显示标签
<ngx-dropzone-image-preview ngProjectAs="ngx-dropzone-preview" *ngFor="let f of files" [file]="f" [removable]="true" (removed)="onRemove(f)">
<ngx-dropzone-label>{{ f.name }} ({{ f.type }})</ngx-dropzone-label>
</ngx-dropzone-image-preview>
I understand your question.I was facing the same issue.For this, you have
to have a blob response. So if you have a url you have to convert it into a
blob response. I have given an example below
URL: string = `https://fireflysemantics.github.io/i/service-parts-
help/electrocardiogram-36732.png`;
files: File[] = [];
this.loadImage().subscribe(i => {
const myFile = new File([i], this.URL, {
type: i.type,
});
this.files.push(myFile)
})
loadImage(): Observable < Blob > {
return this.http.get(this.URL, {
responseType: "blob"
});
}
2条答案
按热度按时间dxpyg8gm1#
您可以使用以下代码预览选定的图像
如果还想显示标签
laik7k3q2#