ng2-image-upload先前上传的图片的预览

时间:2018-12-10 07:51:00

标签: javascript angular7 ng2-image-upload

在我的应用程序中显示以前上传的图像时出现问题。

this.profiles.filepath //value of this varible is  {0: "/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u25.jpeg", 1: "/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u26.jpeg", 2: "/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u27.jpeg"}

for (let i in this.profiles.filepath) {
          this.uploadedImages.push(this.uri + "" + this.profiles.filepath[i]);
        }



this.restImage = [
          "http://localhost:4000/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u25.jpeg",
          "http://localhost:4000/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u26.jpeg",
          "http://localhost:4000/uploads/Restaurants/profile/1544420574509-5yg9t54cjphw4u27.jpeg"
        ];

这是我在componet.ts中的javascript代码 下面是用于文件上传的html标签。

<image-upload [preview]="true" [uploadedFiles]='uploadedImages' [max]="10"  (uploadFinished)="onSelectFile($event)" (removed)="onRemoved($event)"></image-upload>

当我用html标记而不是restImage用html标记编写uploadedImages时,它显示预览,但是如果使用uploadedImages,则不显示任何图形。在控制台日志中,两个变量都具有相同的值。我找不到任何问题。有谁能够帮助我?

  

提前谢谢。

0 个答案:

没有答案