angularjsng-file-upload

How to place a browse button in ngf-drop of ng-file-upload instead of make it whole clickable?


I am using ngf-drop of ng-file-upload in my angular application and in this for select a file to upload we can click anywhere in drag-drop div and a select popup will open to select a file and you can check it in fiddle at : http://jsfiddle.net/s8kc7wg0/799/ but i want to open a select popup only on onclick of a button in this div and i got succeeded to open a select file popup but file is not processing after selection in this. You can check my code for this at http://jsfiddle.net/s8kc7wg0/800/

<div ngf-drop  ng-model="files" class="drop-box" 
    ngf-drag-over-class="'dragover'" ngf-multiple="true" ngf-allow-dir="true"
    accept="image/*,application/pdf" 
    ngf-pattern="'image/*,application/pdf'">Drop pdfs or images here or
    <span class="browsebutton" ngf-select>browse</span></div>

In this i have changed "ngf-select" directive from the upper div to the button in this but its not working.


Solution

  • You need to add ng-model and ngf-multiple to the span button inside div.

    here: jsfiddle.net/s8kc7wg0/801