diff --git a/lib/angular-dropzone.js b/lib/angular-dropzone.js index 515b8b2..e2284cb 100644 --- a/lib/angular-dropzone.js +++ b/lib/angular-dropzone.js @@ -20,9 +20,11 @@ angular.module('ngDropzone', []) var dropzone = new Dropzone(element.get(0), scope.dropzoneConfig); - Object.keys(scope.eventHandlers).forEach(function (eventName) { - dropzone.on(eventName, scope.eventHandlers[eventName]); - }); + if (scope.eventHandlers) { + Object.keys(scope.eventHandlers).forEach(function (eventName) { + dropzone.on(eventName, scope.eventHandlers[eventName]); + }); + } scope.dropzone = dropzone; }