├── .gitignore ├── dist ├── ng-dropzone.min.css.gz ├── ng-dropzone.min.js.gz ├── ng-dropzone.min.js.map.gz ├── ng-dropzone.min.css.map.gz ├── ng-dropzone.min.js ├── ng-dropzone.min.css ├── ng-dropzone.min.css.map ├── ng-dropzone.css ├── ng-dropzone.js └── ng-dropzone.min.js.map ├── bower.json ├── package.json ├── gulpfile.js ├── demo ├── component.html ├── server-mock.html └── main.html ├── src ├── sass │ └── ng-dz-beautify.scss └── js │ └── ng-dropzone.js ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components -------------------------------------------------------------------------------- /dist/ng-dropzone.min.css.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatisuday/ng-dropzone/HEAD/dist/ng-dropzone.min.css.gz -------------------------------------------------------------------------------- /dist/ng-dropzone.min.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatisuday/ng-dropzone/HEAD/dist/ng-dropzone.min.js.gz -------------------------------------------------------------------------------- /dist/ng-dropzone.min.js.map.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatisuday/ng-dropzone/HEAD/dist/ng-dropzone.min.js.map.gz -------------------------------------------------------------------------------- /dist/ng-dropzone.min.css.map.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatisuday/ng-dropzone/HEAD/dist/ng-dropzone.min.css.map.gz -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-dropzone", 3 | "homepage": "https://github.com/thatisuday/ng-dropzone", 4 | "authors": [ 5 | "Uday Hiwarale " 6 | ], 7 | "description": "AngularJS directive for Dropzone, an easy to use drag'n'drop file upload library. http://www.dropzonejs.com", 8 | "main": "dist/ng-dropzone.js", 9 | "keywords": [ 10 | "ngDropzone", 11 | "dropzone" 12 | ], 13 | "license": "Apache 2.0", 14 | "ignore": [ 15 | "**/.*", 16 | "node_modules", 17 | "bower_components", 18 | "test", 19 | "tests" 20 | ], 21 | "dependencies": { 22 | "angular": "^1.5.7", 23 | "dropzone": "^4.3.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngdropzone", 3 | "version": "2.0.2", 4 | "description": "AngularJS directive for __[dropzone](https://github.com/enyo/dropzone)__", 5 | "main": "dist/ng-dropzone.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "build": "gulp build", 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/thatisuday/ng-dropzone.git" 16 | }, 17 | "author": "Uday Hiwarale (https://github.com/thatisuday)", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/thatisuday/ng-dropzone/issues" 21 | }, 22 | "homepage": "https://github.com/thatisuday/ng-dropzone#readme", 23 | "devDependencies": { 24 | "gulp": "^3.9.1", 25 | "gulp-autoprefixer": "^3.1.0", 26 | "gulp-concat": "^2.6.0", 27 | "gulp-cssmin": "^0.1.7", 28 | "gulp-gzip": "^1.4.0", 29 | "gulp-rename": "^1.2.2", 30 | "gulp-sass": "^2.3.2", 31 | "gulp-sourcemaps": "^1.6.0", 32 | "gulp-uglify": "^1.5.4" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var 2 | gulp = require('gulp'), 3 | concat = require('gulp-concat'), 4 | rename = require('gulp-rename'), 5 | cssmin = require('gulp-cssmin'), 6 | sass = require('gulp-sass'), 7 | autoprefixer = require('gulp-autoprefixer'), 8 | uglify = require('gulp-uglify'), 9 | sourcemaps = require('gulp-sourcemaps') 10 | gzip = require('gulp-gzip') 11 | ; 12 | 13 | 14 | // Build JavaScript 15 | gulp.task('buildJS', function(){ 16 | gulp 17 | .src('src/js/**/*.js') 18 | .pipe(concat('ng-dropzone.js')) 19 | .pipe(sourcemaps.init()) 20 | .pipe(gulp.dest('dist')) 21 | .pipe(rename({suffix:'.min'})) 22 | .pipe(uglify()) 23 | .pipe(sourcemaps.write('./')) 24 | .pipe(gulp.dest('dist')) 25 | .pipe(gzip({append:true})) 26 | .pipe(gulp.dest('dist')) 27 | }); 28 | 29 | // Build SASS 30 | gulp.task('buildSASS', function(){ 31 | gulp 32 | .src('src/sass/**/*.scss') 33 | .pipe(sass().on('error', sass.logError)) 34 | .pipe(concat('ng-dropzone.css')) 35 | .pipe(autoprefixer()) 36 | .pipe(sourcemaps.init()) 37 | .pipe(gulp.dest('dist')) 38 | .pipe(rename({suffix:'.min'})) 39 | .pipe(cssmin()) 40 | .pipe(sourcemaps.write('./')) 41 | .pipe(gulp.dest('dist')) 42 | .pipe(gzip({append:true})) 43 | .pipe(gulp.dest('dist')) 44 | }); 45 | 46 | // Build all 47 | gulp.task('build', ['buildJS', 'buildSASS']); 48 | 49 | // Watch all 50 | gulp.task('watch', ['build'], function(){ 51 | gulp.watch('src/js/**/*.js', ['buildJS']); 52 | gulp.watch('src/sass/**/*.scss', ['buildSASS']); 53 | }); -------------------------------------------------------------------------------- /dist/ng-dropzone.min.js: -------------------------------------------------------------------------------- 1 | !function(e){"use strict";function o(e,o){e.module("thatisuday.dropzone",[]).provider("dropzoneOps",function(){var o={};return{setOptions:function(t){e.extend(o,t)},$get:function(){return o}}}).directive("ngDropzone",["$timeout","dropzoneOps",function(t,n){return{restrict:"AE",template:"
",replace:!0,scope:{options:"=?",callbacks:"=?",methods:"=?"},link:function(t,r,l){t.options=t.options||{};var i=e.extend({},n,t.options),s=new o(r[0],i);t.methods=t.methods||{},t.methods.getDropzone=function(){return s},t.methods.getAllFiles=function(){return s.files};var a=["removeFile","removeAllFiles","processQueue","getAcceptedFiles","getRejectedFiles","getQueuedFiles","getUploadingFiles","disable","enable","confirm","createThumbnailFromUrl"];if(e.forEach(a,function(e){t.methods[e]=function(){s[e].apply(s,arguments),t.$$phase||t.$root.$$phase||t.$apply()}}),t.callbacks){var p=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","removedfile","thumbnail","error","processing","uploadprogress","sending","success","complete","canceled","maxfilesreached","maxfilesexceeded","processingmultiple","sendingmultiple","successmultiple","completemultiple","canceledmultiple","totaluploadprogress","reset","queuecomplete"];e.forEach(p,function(o){var n=t.callbacks[o]||e.noop;s.on(o,function(){n.apply(null,arguments),t.$$phase||t.$root.$$phase||t.$apply()})})}}}}])}"object"==typeof module&&module.exports?module.exports=o(require("angular"),require("dropzone")):"function"==typeof define&&define.amd?define(["angular","dropzone"],o):o(e.angular,e.Dropzone)}(this); 2 | //# sourceMappingURL=ng-dropzone.min.js.map 3 | -------------------------------------------------------------------------------- /dist/ng-dropzone.min.css: -------------------------------------------------------------------------------- 1 | .dropzone .dz-message,.dropzone .dz-preview .dz-remove{font-weight:300;text-transform:uppercase;position:absolute}.dropzone{position:relative;padding:5px;cursor:pointer;border:1px solid #eee}.dropzone .dz-message{margin:0;top:50%;left:50%;transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);color:#999;font-size:12px}.dropzone .dz-preview{margin:5px;min-height:auto}.dropzone .dz-preview .dz-image,.dropzone .dz-preview.dz-file-preview .dz-image{border-radius:3px}.dropzone .dz-preview .dz-filename,.dropzone .dz-preview .dz-size{display:none}.dropzone .dz-preview .dz-progress{left:0;width:90%;border-radius:3px;margin-left:5%;margin-right:5%}.dropzone .dz-preview .dz-progress .dz-upload{background:#8BC34A;background:-webkit-linear-gradient(top,#E6EE9C,#8BC34A);background:linear-gradient(to bottom,#E6EE9C,#8BC34A)}.dropzone .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark{margin:0;width:100%;height:100%}.dropzone .dz-preview .dz-error-mark svg,.dropzone .dz-preview .dz-success-mark svg{position:absolute;margin-top:-6px;width:50%;height:50%;transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%)}.dropzone .dz-preview.dz-error .dz-error-message{top:auto;left:0;font-size:12px;font-weight:300;line-height:14px;border-radius:3px;background:#FF9800;background:-webkit-linear-gradient(top,#FFA726,#FF9800);background:linear-gradient(to bottom,#FFA726,#FF9800);text-align:center;margin-top:10px;margin-left:-10px}.dropzone .dz-preview.dz-error .dz-error-message:after{border-bottom:6px solid #FF9800}.dropzone .dz-preview .dz-remove{bottom:0;width:100%;color:#fff;font-size:11px;padding:3px 0;background-color:rgba(100,100,100,.5);z-index:10;white-space:nowrap;overflow:hidden;text-decoration:none}.dropzone.md .dz-preview .dz-image{width:100px;height:100px}.dropzone.md .dz-preview.dz-error .dz-error-message{margin-left:-20px}.dropzone.sm .dz-preview .dz-image{width:80px;height:80px}.dropzone.sm .dz-preview.dz-error .dz-error-message{margin-left:-30px}.dropzone.sm .dz-preview .dz-remove{font-size:10px}.dropzone.xs .dz-preview .dz-image{width:60px;height:60px}.dropzone.xs .dz-preview.dz-error .dz-error-message{margin-left:-40px}.dropzone.xs .dz-preview .dz-remove{font-size:9px} 2 | /*# sourceMappingURL=ng-dropzone.min.css.map */ 3 | -------------------------------------------------------------------------------- /demo/component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ng-dropzone | angular component 1.5 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/sass/ng-dz-beautify.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Beautify Dropzone 3 | * 4 | * @author Uday Hiwarale 5 | * https://www.github.com/thatisuday/ngDropzone 6 | * 7 | * Remove huge border radius, odd colors 8 | * Remove unnecessary preview elements like size, name etc. 9 | * Use .md, .sm, .xs classes with .dropzone class for smaller thumbnail previews 10 | * * * * * * * * * * * * * * * 11 | * Make sure you set font family property in body else add below style to your dropzones 12 | * font-family:sans-serif; 13 | **/ 14 | 15 | .dropzone{ 16 | position:relative; 17 | padding:5px; 18 | cursor:pointer; 19 | border:1px solid #eee; 20 | 21 | /* Drop message */ 22 | .dz-message{ 23 | margin:0; 24 | position: absolute; 25 | top: 50%; 26 | left: 50%; 27 | transform: translate(-50%,-50%); 28 | -moz-transform: translate(-50%,-50%); 29 | -webkit-transform: translate(-50%,-50%); 30 | font-weight:300; 31 | color:#999; 32 | font-size:12px; 33 | text-transform:uppercase; 34 | } 35 | 36 | /* Preview */ 37 | .dz-preview { 38 | margin:5px; 39 | min-height: auto; 40 | 41 | &.dz-file-preview .dz-image{ 42 | border-radius:3px; 43 | } 44 | 45 | /* Preview image */ 46 | .dz-image{ 47 | border-radius:3px; 48 | } 49 | 50 | /* Preview info */ 51 | .dz-size, 52 | .dz-filename{ 53 | display:none; 54 | } 55 | 56 | 57 | /* Progress */ 58 | .dz-progress{ 59 | left:0; 60 | width:90%; 61 | border-radius: 3px; 62 | margin-left:5%; 63 | margin-right:5%; 64 | 65 | .dz-upload{ 66 | background: #8BC34A; 67 | background: linear-gradient(to bottom, #E6EE9C, #8BC34A); 68 | } 69 | } 70 | 71 | /* Callback icons */ 72 | .dz-success-mark,.dz-error-mark { 73 | margin:0; 74 | width:100%; 75 | height:100%; 76 | 77 | svg{ 78 | position:absolute; 79 | margin-top:-6px; 80 | width:50%; 81 | height:50%; 82 | transform: translate(-50%,-50%); 83 | -moz-transform: translate(-50%,-50%); 84 | -webkit-transform: translate(-50%,-50%); 85 | } 86 | } 87 | 88 | /* Error */ 89 | &.dz-error .dz-error-message{ 90 | top:auto; 91 | left:0; 92 | font-size: 12px; 93 | font-weight: 300; 94 | line-height: 14px; 95 | border-radius: 3px; 96 | background: #FF9800; 97 | background: linear-gradient(to bottom, #FFA726, #FF9800); 98 | text-align:center; 99 | margin-top:10px; 100 | margin-left:-10px; 101 | } 102 | &.dz-error .dz-error-message:after{ 103 | border-bottom: 6px solid #FF9800; 104 | } 105 | 106 | /* Remove file */ 107 | .dz-remove{ 108 | position: absolute; 109 | bottom:0; 110 | width:100%; 111 | color:#fff; 112 | font-size:11px; 113 | padding:3px 0; 114 | background-color:rgba(100,100,100,0.5); 115 | font-weight:300; 116 | z-index:10; 117 | text-transform:uppercase; 118 | white-space:nowrap; 119 | overflow:hidden; 120 | text-decoration: none; 121 | } 122 | } 123 | 124 | &.md{ 125 | .dz-preview{ 126 | .dz-image{ 127 | width: 100px; 128 | height: 100px; 129 | } 130 | &.dz-error .dz-error-message{ 131 | margin-left:-20px; 132 | } 133 | } 134 | } 135 | &.sm{ 136 | .dz-preview{ 137 | .dz-image{ 138 | width: 80px; 139 | height: 80px; 140 | } 141 | 142 | &.dz-error .dz-error-message{ 143 | margin-left:-30px; 144 | } 145 | 146 | .dz-remove{ 147 | font-size:10px; 148 | } 149 | } 150 | } 151 | &.xs{ 152 | .dz-preview{ 153 | .dz-image{ 154 | width: 60px; 155 | height: 60px; 156 | } 157 | 158 | &.dz-error .dz-error-message{ 159 | margin-left:-40px; 160 | } 161 | 162 | .dz-remove{ 163 | font-size:9px; 164 | } 165 | } 166 | } 167 | } -------------------------------------------------------------------------------- /dist/ng-dropzone.min.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"names":[],"mappings":"","sources":["ng-dropzone.css"],"sourcesContent":["/*\r\n * Beautify Dropzone\r\n *\r\n * @author Uday Hiwarale \r\n * https://www.github.com/thatisuday/ngDropzone\r\n *\r\n * Remove huge border radius, odd colors\r\n * Remove unnecessary preview elements like size, name etc.\r\n * Use .md, .sm, .xs classes with .dropzone class for smaller thumbnail previews\r\n * * * * * * * * * * * * * * *\r\n * Make sure you set font family property in body else add below style to your dropzones\r\n * font-family:sans-serif;\r\n**/\n.dropzone {\n position: relative;\n padding: 5px;\n cursor: pointer;\n border: 1px solid #eee;\n /* Drop message */\n /* Preview */ }\n .dropzone .dz-message {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n -webkit-transform: translate(-50%, -50%);\n font-weight: 300;\n color: #999;\n font-size: 12px;\n text-transform: uppercase; }\n .dropzone .dz-preview {\n margin: 5px;\n min-height: auto;\n /* Preview image */\n /* Preview info */\n /* Progress */\n /* Callback icons */\n /* Error */\n /* Remove file */ }\n .dropzone .dz-preview.dz-file-preview .dz-image {\n border-radius: 3px; }\n .dropzone .dz-preview .dz-image {\n border-radius: 3px; }\n .dropzone .dz-preview .dz-size,\n .dropzone .dz-preview .dz-filename {\n display: none; }\n .dropzone .dz-preview .dz-progress {\n left: 0;\n width: 90%;\n border-radius: 3px;\n margin-left: 5%;\n margin-right: 5%; }\n .dropzone .dz-preview .dz-progress .dz-upload {\n background: #8BC34A;\n background: -webkit-linear-gradient(top, #E6EE9C, #8BC34A);\n background: linear-gradient(to bottom, #E6EE9C, #8BC34A); }\n .dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {\n margin: 0;\n width: 100%;\n height: 100%; }\n .dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {\n position: absolute;\n margin-top: -6px;\n width: 50%;\n height: 50%;\n transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n -webkit-transform: translate(-50%, -50%); }\n .dropzone .dz-preview.dz-error .dz-error-message {\n top: auto;\n left: 0;\n font-size: 12px;\n font-weight: 300;\n line-height: 14px;\n border-radius: 3px;\n background: #FF9800;\n background: -webkit-linear-gradient(top, #FFA726, #FF9800);\n background: linear-gradient(to bottom, #FFA726, #FF9800);\n text-align: center;\n margin-top: 10px;\n margin-left: -10px; }\n .dropzone .dz-preview.dz-error .dz-error-message:after {\n border-bottom: 6px solid #FF9800; }\n .dropzone .dz-preview .dz-remove {\n position: absolute;\n bottom: 0;\n width: 100%;\n color: #fff;\n font-size: 11px;\n padding: 3px 0;\n background-color: rgba(100, 100, 100, 0.5);\n font-weight: 300;\n z-index: 10;\n text-transform: uppercase;\n white-space: nowrap;\n overflow: hidden;\n text-decoration: none; }\n .dropzone.md .dz-preview .dz-image {\n width: 100px;\n height: 100px; }\n .dropzone.md .dz-preview.dz-error .dz-error-message {\n margin-left: -20px; }\n .dropzone.sm .dz-preview .dz-image {\n width: 80px;\n height: 80px; }\n .dropzone.sm .dz-preview.dz-error .dz-error-message {\n margin-left: -30px; }\n .dropzone.sm .dz-preview .dz-remove {\n font-size: 10px; }\n .dropzone.xs .dz-preview .dz-image {\n width: 60px;\n height: 60px; }\n .dropzone.xs .dz-preview.dz-error .dz-error-message {\n margin-left: -40px; }\n .dropzone.xs .dz-preview .dz-remove {\n font-size: 9px; }\n"],"file":"ng-dropzone.min.css"} -------------------------------------------------------------------------------- /dist/ng-dropzone.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Beautify Dropzone 3 | * 4 | * @author Uday Hiwarale 5 | * https://www.github.com/thatisuday/ngDropzone 6 | * 7 | * Remove huge border radius, odd colors 8 | * Remove unnecessary preview elements like size, name etc. 9 | * Use .md, .sm, .xs classes with .dropzone class for smaller thumbnail previews 10 | * * * * * * * * * * * * * * * 11 | * Make sure you set font family property in body else add below style to your dropzones 12 | * font-family:sans-serif; 13 | **/ 14 | .dropzone { 15 | position: relative; 16 | padding: 5px; 17 | cursor: pointer; 18 | border: 1px solid #eee; 19 | /* Drop message */ 20 | /* Preview */ } 21 | .dropzone .dz-message { 22 | margin: 0; 23 | position: absolute; 24 | top: 50%; 25 | left: 50%; 26 | transform: translate(-50%, -50%); 27 | -moz-transform: translate(-50%, -50%); 28 | -webkit-transform: translate(-50%, -50%); 29 | font-weight: 300; 30 | color: #999; 31 | font-size: 12px; 32 | text-transform: uppercase; } 33 | .dropzone .dz-preview { 34 | margin: 5px; 35 | min-height: auto; 36 | /* Preview image */ 37 | /* Preview info */ 38 | /* Progress */ 39 | /* Callback icons */ 40 | /* Error */ 41 | /* Remove file */ } 42 | .dropzone .dz-preview.dz-file-preview .dz-image { 43 | border-radius: 3px; } 44 | .dropzone .dz-preview .dz-image { 45 | border-radius: 3px; } 46 | .dropzone .dz-preview .dz-size, 47 | .dropzone .dz-preview .dz-filename { 48 | display: none; } 49 | .dropzone .dz-preview .dz-progress { 50 | left: 0; 51 | width: 90%; 52 | border-radius: 3px; 53 | margin-left: 5%; 54 | margin-right: 5%; } 55 | .dropzone .dz-preview .dz-progress .dz-upload { 56 | background: #8BC34A; 57 | background: -webkit-linear-gradient(top, #E6EE9C, #8BC34A); 58 | background: linear-gradient(to bottom, #E6EE9C, #8BC34A); } 59 | .dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark { 60 | margin: 0; 61 | width: 100%; 62 | height: 100%; } 63 | .dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg { 64 | position: absolute; 65 | margin-top: -6px; 66 | width: 50%; 67 | height: 50%; 68 | transform: translate(-50%, -50%); 69 | -moz-transform: translate(-50%, -50%); 70 | -webkit-transform: translate(-50%, -50%); } 71 | .dropzone .dz-preview.dz-error .dz-error-message { 72 | top: auto; 73 | left: 0; 74 | font-size: 12px; 75 | font-weight: 300; 76 | line-height: 14px; 77 | border-radius: 3px; 78 | background: #FF9800; 79 | background: -webkit-linear-gradient(top, #FFA726, #FF9800); 80 | background: linear-gradient(to bottom, #FFA726, #FF9800); 81 | text-align: center; 82 | margin-top: 10px; 83 | margin-left: -10px; } 84 | .dropzone .dz-preview.dz-error .dz-error-message:after { 85 | border-bottom: 6px solid #FF9800; } 86 | .dropzone .dz-preview .dz-remove { 87 | position: absolute; 88 | bottom: 0; 89 | width: 100%; 90 | color: #fff; 91 | font-size: 11px; 92 | padding: 3px 0; 93 | background-color: rgba(100, 100, 100, 0.5); 94 | font-weight: 300; 95 | z-index: 10; 96 | text-transform: uppercase; 97 | white-space: nowrap; 98 | overflow: hidden; 99 | text-decoration: none; } 100 | .dropzone.md .dz-preview .dz-image { 101 | width: 100px; 102 | height: 100px; } 103 | .dropzone.md .dz-preview.dz-error .dz-error-message { 104 | margin-left: -20px; } 105 | .dropzone.sm .dz-preview .dz-image { 106 | width: 80px; 107 | height: 80px; } 108 | .dropzone.sm .dz-preview.dz-error .dz-error-message { 109 | margin-left: -30px; } 110 | .dropzone.sm .dz-preview .dz-remove { 111 | font-size: 10px; } 112 | .dropzone.xs .dz-preview .dz-image { 113 | width: 60px; 114 | height: 60px; } 115 | .dropzone.xs .dz-preview.dz-error .dz-error-message { 116 | margin-left: -40px; } 117 | .dropzone.xs .dz-preview .dz-remove { 118 | font-size: 9px; } 119 | -------------------------------------------------------------------------------- /dist/ng-dropzone.js: -------------------------------------------------------------------------------- 1 | /**! 2 | * AngularJS dropzone directive 3 | * @author Uday Hiwarale 4 | * https://www.github.com/thatisuday/ngDropzone 5 | */ 6 | 7 | 8 | (function(root){ 9 | 'use strict'; 10 | function factory(angular, Dropzone){ 11 | 12 | angular.module('thatisuday.dropzone', []).provider('dropzoneOps', function(){ 13 | /* 14 | * Add default options here 15 | **/ 16 | var defOps = { 17 | //Add your options here 18 | }; 19 | 20 | return { 21 | setOptions : function(newOps){ 22 | angular.extend(defOps, newOps); 23 | }, 24 | $get : function(){ 25 | return defOps; 26 | } 27 | } 28 | }).directive('ngDropzone', ['$timeout', 'dropzoneOps', function($timeout, dropzoneOps){ 29 | return { 30 | restrict : 'AE', 31 | template : '
', 32 | replace : true, 33 | scope : { 34 | options : '=?', //http://www.dropzonejs.com/#configuration-options 35 | callbacks : '=?', //http://www.dropzonejs.com/#events 36 | methods : '=?' //http://www.dropzonejs.com/#dropzone-methods 37 | }, 38 | link : function(scope, iElem, iAttr){ 39 | //Set options for dropzone {override from dropzone options provider} 40 | scope.options = scope.options || {}; 41 | var initOps = angular.extend({}, dropzoneOps, scope.options); 42 | 43 | 44 | //Instantiate dropzone with initOps 45 | var dropzone = new Dropzone(iElem[0], initOps); 46 | 47 | 48 | /*********************************************/ 49 | 50 | 51 | //Instantiate Dropzone methods (Control actions) 52 | scope.methods = scope.methods || {}; 53 | 54 | scope.methods.getDropzone = function(){ 55 | return dropzone; //Return dropzone instance 56 | }; 57 | 58 | scope.methods.getAllFiles = function(){ 59 | return dropzone.files; //Return all files 60 | }; 61 | 62 | var controlMethods = [ 63 | 'removeFile', 'removeAllFiles', 'processQueue', 64 | 'getAcceptedFiles', 'getRejectedFiles', 'getQueuedFiles', 'getUploadingFiles', 65 | 'disable', 'enable', 'confirm', 'createThumbnailFromUrl' 66 | ]; 67 | 68 | angular.forEach(controlMethods, function(methodName){ 69 | scope.methods[methodName] = function(){ 70 | dropzone[methodName].apply(dropzone, arguments); 71 | if(!scope.$$phase && !scope.$root.$$phase) scope.$apply(); 72 | } 73 | }); 74 | 75 | 76 | /*********************************************/ 77 | 78 | 79 | //Set invents (callbacks) 80 | if(scope.callbacks){ 81 | var callbackMethods = [ 82 | 'drop', 'dragstart', 'dragend', 83 | 'dragenter', 'dragover', 'dragleave', 'addedfile', 'removedfile', 84 | 'thumbnail', 'error', 'processing', 'uploadprogress', 85 | 'sending', 'success', 'complete', 'canceled', 'maxfilesreached', 86 | 'maxfilesexceeded', 'processingmultiple', 'sendingmultiple', 'successmultiple', 87 | 'completemultiple', 'canceledmultiple', 'totaluploadprogress', 'reset', 'queuecomplete' 88 | ]; 89 | angular.forEach(callbackMethods, function(method){ 90 | var callback = (scope.callbacks[method] || angular.noop); 91 | dropzone.on(method, function(){ 92 | callback.apply(null, arguments); 93 | if(!scope.$$phase && !scope.$root.$$phase) scope.$apply(); 94 | }); 95 | }); 96 | } 97 | } 98 | } 99 | }]); 100 | } 101 | 102 | 103 | 104 | if ((typeof module === 'object') && module.exports) { 105 | /* CommonJS module */ 106 | module.exports = factory(require('angular'), require('dropzone')); 107 | } else if (typeof define === 'function' && define.amd) { 108 | /* AMD module */ 109 | define(['angular', 'dropzone'], factory); 110 | } else { 111 | /* Browser global */ 112 | factory(root.angular, root.Dropzone); 113 | } 114 | })(this); 115 | -------------------------------------------------------------------------------- /demo/server-mock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ng-dropzone | preview files on server 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 34 | 35 | 36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/js/ng-dropzone.js: -------------------------------------------------------------------------------- 1 | /**! 2 | * AngularJS dropzone directive 3 | * @author Uday Hiwarale 4 | * https://www.github.com/thatisuday/ngDropzone 5 | */ 6 | 7 | 8 | (function(root){ 9 | 'use strict'; 10 | function factory(angular, Dropzone){ 11 | 12 | angular.module('thatisuday.dropzone', []).provider('dropzoneOps', function(){ 13 | /* 14 | * Add default options here 15 | **/ 16 | var defOps = { 17 | //Add your options here 18 | }; 19 | 20 | return { 21 | setOptions : function(newOps){ 22 | angular.extend(defOps, newOps); 23 | }, 24 | $get : function(){ 25 | return defOps; 26 | } 27 | } 28 | }).directive('ngDropzone', ['$timeout', 'dropzoneOps', function($timeout, dropzoneOps){ 29 | return { 30 | restrict : 'AE', 31 | template : '
', 32 | replace : true, 33 | transclude: true, 34 | scope : { 35 | options : '=?', //http://www.dropzonejs.com/#configuration-options 36 | callbacks : '=?', //http://www.dropzonejs.com/#events 37 | methods : '=?' //http://www.dropzonejs.com/#dropzone-methods 38 | }, 39 | link : function(scope, iElem, iAttr){ 40 | //Set options for dropzone {override from dropzone options provider} 41 | scope.options = scope.options || {}; 42 | var initOps = angular.extend({}, dropzoneOps, scope.options); 43 | 44 | 45 | //Instantiate dropzone with initOps 46 | var dropzone = new Dropzone(iElem[0], initOps); 47 | 48 | 49 | /*********************************************/ 50 | 51 | 52 | //Instantiate Dropzone methods (Control actions) 53 | scope.methods = scope.methods || {}; 54 | 55 | scope.methods.getDropzone = function(){ 56 | return dropzone; //Return dropzone instance 57 | }; 58 | 59 | scope.methods.getAllFiles = function(){ 60 | return dropzone.files; //Return all files 61 | }; 62 | 63 | var controlMethods = [ 64 | 'removeFile', 'removeAllFiles', 'processQueue', 65 | 'getAcceptedFiles', 'getRejectedFiles', 'getQueuedFiles', 'getUploadingFiles', 66 | 'disable', 'enable', 'confirm', 'createThumbnailFromUrl' 67 | ]; 68 | 69 | angular.forEach(controlMethods, function(methodName){ 70 | scope.methods[methodName] = function(){ 71 | dropzone[methodName].apply(dropzone, arguments); 72 | if(!scope.$$phase && !scope.$root.$$phase) scope.$apply(); 73 | } 74 | }); 75 | 76 | 77 | /*********************************************/ 78 | 79 | 80 | //Set invents (callbacks) 81 | if(scope.callbacks){ 82 | var callbackMethods = [ 83 | 'drop', 'dragstart', 'dragend', 84 | 'dragenter', 'dragover', 'dragleave', 'addedfile', 'removedfile', 85 | 'thumbnail', 'error', 'processing', 'uploadprogress', 86 | 'sending', 'success', 'complete', 'canceled', 'maxfilesreached', 87 | 'maxfilesexceeded', 'processingmultiple', 'sendingmultiple', 'successmultiple', 88 | 'completemultiple', 'canceledmultiple', 'totaluploadprogress', 'reset', 'queuecomplete' 89 | ]; 90 | angular.forEach(callbackMethods, function(method){ 91 | var callback = (scope.callbacks[method] || angular.noop); 92 | dropzone.on(method, function(){ 93 | callback.apply(null, arguments); 94 | if(!scope.$$phase && !scope.$root.$$phase) scope.$apply(); 95 | }); 96 | }); 97 | } 98 | } 99 | } 100 | }]); 101 | } 102 | 103 | 104 | 105 | if ((typeof module === 'object') && module.exports) { 106 | /* CommonJS module */ 107 | module.exports = factory(require('angular'), require('dropzone')); 108 | } else if (typeof define === 'function' && define.amd) { 109 | /* AMD module */ 110 | define(['angular', 'dropzone'], factory); 111 | } else { 112 | /* Browser global */ 113 | factory(root.angular, root.Dropzone); 114 | } 115 | })(this); 116 | -------------------------------------------------------------------------------- /dist/ng-dropzone.min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["ng-dropzone.min.js"],"names":["root","factory","angular","Dropzone","module","provider","defOps","setOptions","newOps","extend","$get","directive","$timeout","dropzoneOps","restrict","template","replace","scope","options","callbacks","methods","link","iElem","iAttr","initOps","dropzone","getDropzone","getAllFiles","files","controlMethods","forEach","methodName","apply","arguments","$$phase","$root","$apply","callbackMethods","method","callback","noop","on","exports","require","define","amd","this"],"mappings":"CAOA,SAAUA,GACN,YACF,SAASC,GAAQC,EAASC,GAExBD,EAAQE,OAAO,0BAA2BC,SAAS,cAAe,WAIhE,GAAIC,KAIJ,QACEC,WAAa,SAASC,GACpBN,EAAQO,OAAOH,EAAQE,IAEzBE,KAAO,WACL,MAAOJ,OAGVK,UAAU,cAAe,WAAY,cAAe,SAASC,EAAUC,GACxE,OACEC,SAAW,KACXC,SAAW,cACXC,SAAU,EACVC,OACEC,QAAU,KACVC,UAAY,KACZC,QAAU,MAEZC,KAAO,SAASJ,EAAOK,EAAOC,GAE5BN,EAAMC,QAAUD,EAAMC,WACtB,IAAIM,GAAUtB,EAAQO,UAAWI,EAAaI,EAAMC,SAIhDO,EAAW,GAAItB,GAASmB,EAAM,GAAIE,EAOtCP,GAAMG,QAAUH,EAAMG,YAEtBH,EAAMG,QAAQM,YAAc,WAC1B,MAAOD,IAGTR,EAAMG,QAAQO,YAAc,WAC1B,MAAOF,GAASG,MAGlB,IAAIC,IACF,aAAc,iBAAkB,eAChC,mBAAoB,mBAAoB,iBAAkB,oBAC1D,UAAW,SAAU,UAAW,yBAelC,IAZA3B,EAAQ4B,QAAQD,EAAgB,SAASE,GACvCd,EAAMG,QAAQW,GAAc,WAC1BN,EAASM,GAAYC,MAAMP,EAAUQ,WACjChB,EAAMiB,SAAYjB,EAAMkB,MAAMD,SAASjB,EAAMmB,YASlDnB,EAAME,UAAU,CACjB,GAAIkB,IACF,OAAQ,YAAa,UACrB,YAAa,WAAY,YAAa,YAAa,cACnD,YAAa,QAAS,aAAc,iBACpC,UAAW,UAAW,WAAY,WAAY,kBAC9C,mBAAoB,qBAAsB,kBAAmB,kBAC7D,mBAAoB,mBAAoB,sBAAuB,QAAS,gBAE1EnC,GAAQ4B,QAAQO,EAAiB,SAASC,GACxC,GAAIC,GAAYtB,EAAME,UAAUmB,IAAWpC,EAAQsC,IACnDf,GAASgB,GAAGH,EAAQ,WAClBC,EAASP,MAAM,KAAMC,WACjBhB,EAAMiB,SAAYjB,EAAMkB,MAAMD,SAASjB,EAAMmB,mBAWxC,gBAAXhC,SAAwBA,OAAOsC,QAEzCtC,OAAOsC,QAAUzC,EAAQ0C,QAAQ,WAAYA,QAAQ,aAC1B,kBAAXC,SAAyBA,OAAOC,IAEhDD,QAAQ,UAAW,YAAa3C,GAGhCA,EAAQD,EAAKE,QAASF,EAAKG,WAE5B2C","file":"ng-dropzone.min.js","sourcesContent":["/**!\r\n * AngularJS dropzone directive\r\n * @author Uday Hiwarale \r\n * https://www.github.com/thatisuday/ngDropzone\r\n */\r\n \r\n \r\n(function(root){\r\n 'use strict';\r\n function factory(angular, Dropzone){\r\n \r\n angular.module('thatisuday.dropzone', []).provider('dropzoneOps', function(){\r\n /*\r\n * Add default options here\r\n **/\r\n var defOps = {\r\n //Add your options here\r\n };\r\n \r\n return {\r\n setOptions : function(newOps){\r\n angular.extend(defOps, newOps);\r\n },\r\n $get : function(){\r\n return defOps;\r\n }\r\n }\r\n }).directive('ngDropzone', ['$timeout', 'dropzoneOps', function($timeout, dropzoneOps){\r\n return {\r\n restrict : 'AE',\r\n template : '
',\r\n replace : true,\r\n scope : {\r\n options : '=?', //http://www.dropzonejs.com/#configuration-options\r\n callbacks : '=?', //http://www.dropzonejs.com/#events\r\n methods : '=?' //http://www.dropzonejs.com/#dropzone-methods\r\n },\r\n link : function(scope, iElem, iAttr){\r\n //Set options for dropzone {override from dropzone options provider}\r\n scope.options = scope.options || {};\r\n var initOps = angular.extend({}, dropzoneOps, scope.options);\r\n \r\n \r\n //Instantiate dropzone with initOps\r\n var dropzone = new Dropzone(iElem[0], initOps);\r\n \r\n \r\n /*********************************************/\r\n \r\n \r\n //Instantiate Dropzone methods (Control actions)\r\n scope.methods = scope.methods || {};\r\n \r\n scope.methods.getDropzone = function(){ \r\n return dropzone; //Return dropzone instance\r\n };\r\n \r\n scope.methods.getAllFiles = function(){ \r\n return dropzone.files; //Return all files\r\n };\r\n \r\n var controlMethods = [\r\n 'removeFile', 'removeAllFiles', 'processQueue',\r\n 'getAcceptedFiles', 'getRejectedFiles', 'getQueuedFiles', 'getUploadingFiles',\r\n 'disable', 'enable', 'confirm', 'createThumbnailFromUrl'\r\n ];\r\n \r\n angular.forEach(controlMethods, function(methodName){\r\n scope.methods[methodName] = function(){\r\n dropzone[methodName].apply(dropzone, arguments);\r\n if(!scope.$$phase && !scope.$root.$$phase) scope.$apply();\r\n }\r\n });\r\n \r\n \r\n /*********************************************/\r\n \r\n \r\n //Set invents (callbacks)\r\n if(scope.callbacks){\r\n var callbackMethods = [\r\n 'drop', 'dragstart', 'dragend',\r\n 'dragenter', 'dragover', 'dragleave', 'addedfile', 'removedfile',\r\n 'thumbnail', 'error', 'processing', 'uploadprogress',\r\n 'sending', 'success', 'complete', 'canceled', 'maxfilesreached',\r\n 'maxfilesexceeded', 'processingmultiple', 'sendingmultiple', 'successmultiple',\r\n 'completemultiple', 'canceledmultiple', 'totaluploadprogress', 'reset', 'queuecomplete'\r\n ];\r\n angular.forEach(callbackMethods, function(method){\r\n var callback = (scope.callbacks[method] || angular.noop);\r\n dropzone.on(method, function(){\r\n callback.apply(null, arguments);\r\n if(!scope.$$phase && !scope.$root.$$phase) scope.$apply();\r\n });\r\n });\r\n }\r\n }\r\n }\r\n }]);\r\n }\r\n \r\n \r\n\r\n if ((typeof module === 'object') && module.exports) {\r\n /* CommonJS module */\r\n module.exports = factory(require('angular'), require('dropzone'));\r\n } else if (typeof define === 'function' && define.amd) {\r\n /* AMD module */\r\n define(['angular', 'dropzone'], factory);\r\n } else {\r\n /* Browser global */\r\n factory(root.angular, root.Dropzone);\r\n }\r\n})(this);\r\n"]} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Need maintainers 2 | This project is no longer maintained. Though this project is in good health, we would appreciate if someone collaborates to fix potential bugs and enhancement requests. 3 | 4 | *** 5 | 6 | ![](https://camo.githubusercontent.com/0ac4844780d7e981e44a9ca97887476f50a0b840/687474703a2f2f7777772e64726f707a6f6e656a732e636f6d2f696d616765732f6e65772d6c6f676f2e737667) 7 | 8 | # ng-dropzone ![bower](https://img.shields.io/bower/v/ngdropzone.svg?style=flat-square) [![npm downloads](https://img.shields.io/npm/dt/ngdropzone.svg?style=flat-square)](https://www.npmjs.com/package/ngdropzone) [![preview](https://img.shields.io/badge/preview-click_here-green.svg?style=flat-square)](https://rawgit.com/thatisuday/ng-dropzone/master/demo/main.html) 9 | 10 | AngularJS directive for __[dropzone](https://github.com/enyo/dropzone)__ 11 | 12 | #### UPDATE 13 | In latest release **v1.0.5**, distribution files have been renamed to match newly changed package name. Please **rename urls** to distribution files if you are updating this package. Also, **gulp** and **sass** support have been added. 14 | 15 | *** 16 | 17 | ## 1. Getting started 18 | 19 | ### → Install using npm 20 | ``` 21 | npm install ngdropzone 22 | ``` 23 | 24 | ### → Install using bower 25 | Run following command in your working directory using shell/cmd 26 | ``` 27 | bower install ngdropzone 28 | ``` 29 | 30 | 1. Include `angular.js` and `dropzone.js`, `dropzone.css` from bower_components. 31 | 2. Include `ng-dropzone.min.js` from `dist` folder of `ng-dropzone` package inside bower_component. 32 | 3. You can also include `ng-dropzone.min.css` but it's not necessary. I have **overridden** some **ugly looking** css from `dropzone.css` 33 | 34 | ### → Install manually 35 | ##### Step 1 36 | You must have AngularJS library included for this directive to work : [Download from Google CDN](https://developers.google.com/speed/libraries/#angularjs) 37 | 38 | ##### Step 2 39 | You need to download `dropzone.js` and `dropzone.css` files from dropzone repository : [Get from official release](https://github.com/enyo/dropzone/releases/tag/v4.3.0) 40 | 41 | ##### Step 3 42 | Download `ng-dropzone.min.js` from this [official release](https://github.com/thatisuday/ng-dropzone/releases) 43 | 44 | ##### Step 4 45 | Include above files in `` section of your html page 46 | 47 | ---------- 48 | 49 | ## 2. Create .js file and set _Dropzone.autoDiscover_ to _false_ 50 | ``` 51 | //Add below line at the top of your JavaScript code 52 | Dropzone.autoDiscover = false; 53 | //This will prevent Dropzone to instantiate on it's own unless you are using dropzone class for styling 54 | ``` 55 | 56 | *** 57 | 58 | ## 3. Configure your angular app 59 | Include `thatisuday.dropzone` module inside your angular app. 60 | ``` 61 | var myNgApp = angular.module('myAppName', ['thatisuday.dropzone']); 62 | ``` 63 | 64 | ####⛹Optional 65 | > You can configure dropzone before an app starts running. ng-dropzone comes with built in **dropzoneOps** provider to configure [dropzone options](http://www.dropzonejs.com/#configuration-options) which can be implemented as below. _setOptions_ function will set default options fot all your dropzone instances in that app. 66 | 67 | ``` 68 | myNgApp.config(function(dropzoneOpsProvider){ 69 | dropzoneOpsProvider.setOptions({ 70 | url : '/upload_url', 71 | maxFilesize : '10', 72 | ... 73 | }); 74 | }); 75 | ``` 76 | 77 | ####⛹Optional 78 | >You can also add default options in **dropzoneOps** provider `(ng-dropzone.min.js)` inside `defOps` object. This is very helpful in case you have multiple apps. **_But it is not recommended because if you upgrade this directive in future, your app might not behave the way it should._** 79 | 80 | *** 81 | 82 | ## 4. Create dropzone(s) 83 | You can create dropzone using `ng-dropzone` attribute or `` element. 84 | ``` 85 |
86 | ``` 87 | **_OR_** 88 | ``` 89 | 90 | ``` 91 | > **options** attribute specifies model that will set [options (click to see)](http://www.dropzonejs.com/#configuration-options) for dropzone and will override any options that may have been provided with **dropzoneOps** provider. For example, `$scope.dzOptions = {bla:bleh,...};` 92 | 93 | > **callbacks** attribute specifies model that will handle [events (click to see)](http://www.dropzonejs.com/#events) for dropzone. For example, `$scope.dzCallbacks.addedfile = function(file){//do something};` 94 | 95 | > **methods** attribute specifies model that will set [methods (click to see)](http://www.dropzonejs.com/#dropzone-methods) for dropzone. For example, `$scope.dzMethods.removeFile(file);` or `` 96 | 97 | As per above example, **_dzOptions_** is model that set options for dropzone, **_dzCallbacks_** is model that handles events for dropzone while **_dzMethods_** is _gateway_ model that triggers dropzone methods. 98 | 99 | *** 100 | 101 | ## 5. Configure dropzone(s) 102 | **callbacks** are not necessary for your dropzone to work, these are just events that you may need as a callback for certain activities of your dropzone. But **options** must be given inside your controller _unless you are configuring it from **dropzoneOps** provider_. _url_ field in dropzone options is mandatory. 103 | 104 | ``` 105 | myNgApp.controller('main', function($scope){ 106 | //Set options for dropzone 107 | //Visit http://www.dropzonejs.com/#configuration-options for more options 108 | $scope.dzOptions = { 109 | url : '/alt_upload_url', 110 | paramName : 'photo', 111 | maxFilesize : '10', 112 | acceptedFiles : 'image/jpeg, images/jpg, image/png', 113 | addRemoveLinks : true, 114 | ... 115 | }; 116 | 117 | 118 | //Handle events for dropzone 119 | //Visit http://www.dropzonejs.com/#events for more events 120 | $scope.dzCallbacks = { 121 | 'addedfile' : function(file){ 122 | console.log(file); 123 | $scope.newFile = file; 124 | }, 125 | 'success' : function(file, xhr){ 126 | console.log(file, xhr); 127 | }, 128 | ... 129 | }; 130 | 131 | 132 | //Apply methods for dropzone 133 | //Visit http://www.dropzonejs.com/#dropzone-methods for more methods 134 | $scope.dzMethods = {}; 135 | $scope.removeNewFile = function(){ 136 | $scope.dzMethods.removeFile($scope.newFile); //We got $scope.newFile from 'addedfile' event callback 137 | } 138 | }); 139 | ``` 140 | 141 | By default, dropzone starts file upload when file is dropped or added to the list. But this can be prevented using `autoProcessQueue:false` in options. Then you have to manually start file upload using **_dzMethods_** model. You just have to call function `dzMethods.processQueue();` to start upload. 142 | 143 | > For better understanding, **__⚑__** checkout source code in /test/test.html file or visit second example in [preview](https://rawgit.com/thatisuday/ng-dropzone/master/demo/main.html) of this directive. 144 | 145 | > I have added two more extra methods `getDropzone` and `getAllFiles` which returns **dropzone instance** and **dropzone files** respectively. These methods do not accept any _arguments_ and only work with _ng-dropzone_. 146 | 147 | > If `$scope.dzMethods.method` throws _undefined_ error, wrap it in `$timeout(function(){...})`. This happens because you are referencing an object that is empty as dropzone is not yet property linked with the controller scope. 148 | 149 | *** 150 | 151 | ## 6. Buffer paste 152 | use **[ng-buffer-dropzone](https://github.com/thatisuday/ng-buffer-dropzone)** for image buffer paste on dropzone. 153 | 154 | *** 155 | 156 | ## 7. Complaints & Contribute 157 | 1. Feel free to create as many issues as you want to report bugs. 158 | 2. Take a fork and create pull request for bug fixes and enhancements. 159 | 3. Please raise an issue if `dropzone.js` have new updates. 160 | 161 | *** 162 | 163 | ## Updates 164 | 1. Version 2.0.0 out 165 | 2. Lesson on how to mock files from server into your dropzone : [Wiki here](https://github.com/thatisuday/ng-dropzone/wiki/Mock-files-(already-uploaded)-from-server-into-dropzone) [Preview here](https://rawgit.com/thatisuday/ng-dropzone/master/demo/server-mock.html) 166 | 167 | *** 168 | 169 | ### Liked it? Give it a star 🌟. I would love it :) 170 | -------------------------------------------------------------------------------- /demo/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ng-dropzone simple example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 34 | 35 | 36 |

ng-dropzone

37 |

38 | Angularjs directive for Dropzone, an easy to use drag'n'drop file upload library. 39 |

40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 |
49 |
50 | 51 |

52 | 53 | 54 |
55 |
56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 |
64 | 65 |

66 | 67 | 68 |

Dropzone for button as a trigger

69 |
70 | 71 |
72 |

Chech source code to know how to set up. You need to set display:none on dropzone.

73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 |


81 | 82 |

83 | I have used ng-dropzone.css for clean dropzone UI in these examples. 84 |

85 | 86 | 87 |
88 | Follow @thatisuday 89 | 90 | Star 91 | 92 | Download 93 |
94 | 95 |

96 | 97 | 98 |
99 | 100 | Go Back to GitHub 101 |

102 | 103 |

104 | 105 | 106 | 107 | 108 | 109 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------