Skip to content

Commit

Permalink
Check if eventHandlers exist before trying to register them
Browse files Browse the repository at this point in the history
  • Loading branch information
sandbochs committed Apr 4, 2014
1 parent a9b6383 commit 788cb8e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/angular-dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 788cb8e

Please sign in to comment.