Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sandbochs committed Apr 4, 2014
1 parent 110e2fe commit a9b6383
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "angular-dropzone",
"version": "0.1.0",
"homepage": "https://github.com/sandbochs/angular-dropzone",
"authors": [
"Elliot Shiu <[email protected]>"
],
"description": "angular-dropzone is a AngularJS directive for Dropzone.js",
"main": "lib/ng-dropzone.js",
"keywords": [
"angular-dropzone",
"ng-dropzone",
"dropzone.js",
"dropzone"
],
"license": "MIT",
"ignore": [
"**/.*",
"test"
]
}
30 changes: 30 additions & 0 deletions lib/angular-dropzone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

angular.module('ngDropzone', [])

.directive('ngDropzone', function () {
return {
restrict: 'AE',
template: '<div ng-transclude></div>',
transclude: true,
scope: {
dropzone: '=',
dropzoneConfig: '=',
eventHandlers: '='
},
link: function(scope, element, attrs, ctrls) {
try { Dropzone }
catch (error) {
throw new Error('Dropzone.js not loaded.');
}

var dropzone = new Dropzone(element.get(0), scope.dropzoneConfig);

Object.keys(scope.eventHandlers).forEach(function (eventName) {
dropzone.on(eventName, scope.eventHandlers[eventName]);
});

scope.dropzone = dropzone;
}
};
});

0 comments on commit a9b6383

Please sign in to comment.