3

I'm using ng2-file-upload module for Angular2 and I want to have a drag and drop area and at the same time the posibility to click in that area and select a single file.

In their examples it is separated and there is no example with both together. For example:

<div ng2FileDrop
     [ngClass]="{'nv-file-over': hasBaseDropZoneOver}"
     (fileOver)="fileOverBase($event)"
     [uploader]="uploader"
     class="well my-drop-zone">
     Base drop zone
</div>

Single
<input type="file" ng2FileSelect [uploader]="uploader" />

Thanks!

1
  • is it ng2FileDrop working? if it is working can u create plunker for this? Commented Jun 22, 2017 at 11:20

1 Answer 1

6

I found a solution :)

<div class="col-md-6 p_0"
   [ngClass]="{'file-over': hasBaseDropZoneOver}"
   ng2FileDrop [uploader]="uploader"
   (click)="fileInput.click()">

   Base drop zone
   <input type="file" #fileInput ng2FileSelect [uploader]="uploader" style="display: none"/>
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

is it ng2FileDrop working? if it is working can u create plunker for this?
However nothing happens if you drop the file, you just change the CSS class on file over...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.