Skip to content

Commit

Permalink
Merge pull request #37 from edgarnadal/master
Browse files Browse the repository at this point in the history
Added ng-file-drag-over-class attribute
  • Loading branch information
danialfarid committed Nov 6, 2013
2 parents 6fd3a9c + 064b7a1 commit bbf2c44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ HTML:
<input type="file" ng-file-select="onFileSelect($files)" >
<input type="file" ng-file-select="onFileSelect($files)" multiple>
<div ng-file-drop="onFileSelect($files);" ng-show="dropSupported">drop files here</div>
<div ng-file-drop="onFileSelect($files);" ng-file-drag-over-class="myOwnDragOver">This is an optional parameter</div>
<div ng-file-drop-available="dropSupported=true" ng-show="!dropSupported">HTML5 Drop File is not supported!</div>
<button ng-click="upload.abort()">Cancel Upload</button>
</div>
Expand Down
8 changes: 4 additions & 4 deletions angular-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$http', function($parse,
elem[0].addEventListener("dragover", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem.addClass("dragover");
elem.addClass(attr['ngFileDragOverClass'] || "dragover");
}, false);
elem[0].addEventListener("dragleave", function(evt) {
elem.removeClass("dragover");
elem.removeClass(attr['ngFileDragOverClass'] || "dragover");
}, false);
elem[0].addEventListener("drop", function(evt) {
evt.stopPropagation();
evt.preventDefault();
elem.removeClass("dragover");
elem.removeClass(attr['ngFileDragOverClass'] || "dragover");
var files = [], fileList = evt.dataTransfer.files, i;
if (fileList != null) {
for (i = 0; i < fileList.length; i++) {
Expand All @@ -109,4 +109,4 @@ angularFileUpload.directive('ngFileDrop', [ '$parse', '$http', function($parse,
};
} ]);

})();
})();

0 comments on commit bbf2c44

Please sign in to comment.