zefoy / ngx-dropzone-wrapper

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

Working with config autoProcessQueues = false #27

Closed KshitizGIT closed 7 years ago

KshitizGIT commented 7 years ago

How do I manually process queues ? Is there a event exposed for this?

sconix commented 7 years ago

You need to check dropzone documentation. All events and dropzone object are exposed.

rafaelss95 commented 7 years ago

I was facing the same "problem" today, so I found the following docs which points me to the right direction.

My config is the following:

public config: DropzoneConfigInterface = {
  // ...
  autoProcessQueue: false,
  init: function() {
    const dropzone: any = this;
    document.querySelector('button[type=submit]').addEventListener('click', (event: MouseEvent) => {
      event.preventDefault();
      event.stopPropagation();
      dropzone.processQueue();        
    });
};
sboyd commented 7 years ago

@sconix thanks for writing this wrapper!

@rafaelss95 and anyone else who has this question the cleaner approach would be the following and they are using the component version.

@ViewChild(DropzoneComponent) componentRef: DropzoneComponent;

//process the queue this.componentRef.directiveRef.dropzone.processQueue();

Then you don't need the workaround listed above. --Steve

chenkie commented 7 years ago

Quick edit to @sboyd's answer above, the snippet should be:

@ViewChild(DropzoneComponent) componentRef: DropzoneComponent;

this.componentRef.directiveRef.dropzone().processQueue();

This will get the dropzone instance.

sboyd commented 6 years ago

@chenkie my guess is that it depends on the version of the wrapper you are using. I'm using version 4.x.x and the way I get the dropzone instance is what I'd posted in my comment. Now if you're using the same version of the wrapper I'm at a total loss :0)

chenkie commented 6 years ago

Ah, I'm on v5. Thanks for clarifying :)

sboyd commented 6 years ago

My bad....I should have stated that in the first place. Have a great day. --Steve