Preview multiple image before upload file in Angular

前端 未结 2 544
予麋鹿
予麋鹿 2020-12-16 03:40

How can I preview multiple images that I have selected before uploading them in Angular?

I have managed to do it but only with one image, even though I sele

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 04:15

    we can use *ngFor like so:

    I added the index because its useful to have sometimes, if the array isnt just simply a string array, instead a json or object array you might have to do this:

    [src]="img.url"

    I am not sure how to upload/select the files for upload but I would assume when you select them from the computer and/or URL that you simply add their URL to an array

提交回复
热议问题