zefoy / ngx-dropzone-wrapper

Angular wrapper library for Dropzone
MIT License
174 stars 51 forks source link

How to Clear Directive #92

Open johvahn2 opened 6 years ago

johvahn2 commented 6 years ago

I'm having a problem clearing the directive image space, I'm not sure if I doing it the correct way

@ViewChild(DropzoneDirective) directiveRef: DropzoneDirective;

public resetDropzone(): void {
      this.directiveRef.reset();
    }

and the html

                                    <div #dz class="m-dropzone dropzone" [dropzone]="config" 
                                        (error)="onUploadError($event)" 
                                         (success)="onUploadSuccess($event)">
                                        <div class="m-dropzone__msg dz-message needsclick">
                                            <h3 class="m-dropzone__msg-title">
                                                Drop files here or click to upload.
                                            </h3>
                                            <span class="m-dropzone__msg-desc">
                                                This is just a dropzone. Selected files are
                                                <strong>
                                                    uploaded
                                                </strong>
                                            </span>
                                        </div>
                                        <div class="m-dropzone__msg dz-message needsclick">
                                            <h3 class="m-dropzone__msg-title">
                                                Drop files here or click to upload.
                                            </h3>
                                            <span class="m-dropzone__msg-desc">
                                                This is just a dropzone. Selected files are
                                                <strong>
                                                    uploaded
                                                </strong>
                                            </span>
                                        </div>
                                    </div>
sconix commented 6 years ago

The example has an example how to use the clear with directive. Depending if you are doing some manual files adding the reset might not be enough, but thats a Dropzone specific thing so I am not qualified to answer how to use Dropzone.

johvahn2 commented 6 years ago

The example as the same thing, still not getting it to work

sconix commented 6 years ago

The reset just calls Dropzone removeAllFiles so you might need to look into Dropzone documentation how it works.