zefoy / ngx-dropzone-wrapper

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

How to trigger UploadProcess if autoProcessQueue is false ? #126

Open tricksta opened 5 years ago

tricksta commented 5 years ago

The progress of uploading is stoped after onFilesDropped event. Is it possible the trigger the process and post files manually ? I am using the directive version.

TEMPLATE

<div
            #drpzone="ngxDropzone"
            class="dropzone"
            [dropzone]="dropzoneConfig"
            (addedFile)="onFilesDropped($event)"
></div>

COMPONENT

@ViewChild(DropzoneDirective) drpzone: DropzoneDirective;

 public dropzoneConfig: DropzoneConfigInterface = {
        autoProcessQueue: false
  };

 onFilesDropped(files: File[]) {
        const dropzoneInstance = this.drpzone.dropzone();
        dropzoneInstance.processQueue();
 }

SCREENSHOT image

harshamaddineni commented 5 years ago

by using processQueue() method. dropZone: any; @ViewChild(DropzoneComponent) componentRef?: DropzoneComponent; @ViewChild(DropzoneDirective) directiveRef?: DropzoneDirective;

ngAfterViewInit() { this.dropZone = this.componentRef.directiveRef.dropzone(); }

// If we want to processQueue(), we can do it by this.dropZone.processQueue();

tricksta commented 5 years ago

processQueue function triggers only if I add second file to dropzone, then the previous file start upload process.

onUploadFile(args: any) { console.log('onUploadFile:', args); this.dropZone.processQueue(); }

image

why the second file doesn't trigger instantly or I am using wrong event ? Actually I am using (addedFile)="onUploadFile($event)"