zefoy / ngx-dropzone-wrapper

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

How to use reset() Function in angular way. #42

Closed nileshyadav326 closed 7 years ago

nileshyadav326 commented 7 years ago

Hi I want to call reset() click of submit button or any other event

Available control / helper functions (provided by the directive):

reset() // Resets the dropzone upload area (removes all finished preview files).

below is my code .html file

<dropzone [config]="config" [message]="'Click or drag images here to upload'" (error)="onUploadError($event)" (success)="onUploadSuccess($event)" (complete)="onUploadComplete($event)" ></dropzone>

and .componet file.

public config: DropzoneConfigInterface = {
        paramName: 'inputFiles',
        addRemoveLinks:true
    };

    onUploadError(args: any) {
        console.log('onUploadError:', args);
    }

    onUploadSuccess(args: any) {
        console.log('onUploadSuccess:', args);
    }

    onUploadComplete(args: any) {
       console.log('onUploadComplete:', args); 
       this.reset();
    }
sconix commented 7 years ago

Like you would call any component functions in Angular. Have a look at the example app code if you are new to Angular.

wasiff commented 5 years ago

HTML: <dropzone [config]="config" [message]="'Click or drag images here to upload'" (drop)="onFileDropped($event)" (sending)="onSending($event)" (error)="onUploadError($event)" (success)="onUploadSuccess($event, dz)" (removeFile)="onRemoveFile($event)"

dz>

        </dropzone>

Component.ts @ViewChild('dz') drpzone: DropzoneComponent;

this.drpzone.directiveRef.reset() this.drpzone.directiveRef.dropzone();