ogix / ng2-fancy-image-uploader

Angular2 async image uploader with preview:
https://ogix.github.io/fancy-image-uploader-demo
MIT License
18 stars 11 forks source link

Display initial image #15

Open GeekyMonkey opened 6 years ago

GeekyMonkey commented 6 years ago

I want to use this on a form where the user may have already uploaded an image previously. So they're not adding an image, but they can replace the image. Is it possible with this control to display that initial image instead of the empty box with the "add" text?

ogix commented 6 years ago

If you are using reactive forms then it is possible to specify: formControlName="imageUrl".

joaolori commented 6 years ago

How can i implement this?

formControlName="imageUrl" ?

joaolori commented 6 years ago

Can u provide example for this @ogix

enyachoke commented 6 years ago

@GeekyMonkey Did you figure this out

GeekyMonkey commented 6 years ago

No. Sorry. I gave up on this control and rolled my own. It wasn't a great fit for my use anyway.

enyachoke commented 6 years ago

Anyway if somebody needs it

 public fileControl = new FormControl();
 ngOnInit() {

        this.fileControl.setValue('url', { emitEvent: false});

    }
<fancy-image-uploader id="field_photoUrl" name="photoUrl"  [formControl]="fileControl"  [options]="options" (onUpload)="onUpload($event)"></fancy-image-uploader>
jirapatj commented 6 years ago

i try from @enyachoke suggestion. it does not working. I got some error. Can you help me to fix?

screen shot 2018-06-23 at 00 07 02 screen shot 2018-06-23 at 00 06 42