Skip to content

Commit 3dc39cb

Browse files
committed
BUGFIX: Pass the filemanager event through via $event in angular
1 parent 8224a14 commit 3dc39cb

File tree

2 files changed

+44
-18
lines changed

2 files changed

+44
-18
lines changed

ng-batchupload.js

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,33 @@ angular.module('batchUpload', [])
5858
},
5959
bindToController: true,
6060
controller: ['$element', 'batchUploadManager', function($element, batchUploadManager) {
61-
var settings = {};
61+
var settings = {},
62+
ctrl = this,
63+
onComplete = function(e) {
64+
ctrl.buOnComplete({$event: e});
65+
},
66+
onError = function(e) {
67+
ctrl.buOnError({$event: e});
68+
},
69+
onFileStart = function(e) {
70+
ctrl.buOnFileStart({$event: e});
71+
},
72+
onStart = function(e) {
73+
ctrl.buOnStart({$event: e});
74+
},
75+
onPause = function(e) {
76+
ctrl.buOnPause({$event: e});
77+
},
78+
onProgress = function(e) {
79+
ctrl.buOnProgress({$event: e});
80+
},
81+
onInvalid = function(e) {
82+
ctrl.buOnInvalid({$event: e});
83+
},
84+
onQueue = function(e) {
85+
ctrl.buOnQueue({$event: e});
86+
}
87+
;
6288

6389
this.$onInit = function() {
6490

@@ -111,69 +137,69 @@ angular.module('batchUpload', [])
111137
this.dropzone = new FileDropZone($element[0], settings);
112138

113139
if (!!this.buOnComplete) {
114-
settings.manager.on('complete', this.buOnComplete);
140+
settings.manager.on('complete', onComplete);
115141
}
116142

117143
if (!!this.buOnError) {
118-
settings.manager.on('error', this.buOnError);
144+
settings.manager.on('error', onError);
119145
}
120146

121147
if (!!this.buOnFileStart) {
122-
settings.manager.on('file_start', this.buOnFileStart);
148+
settings.manager.on('file_start', onFileStart);
123149
}
124150

125151
if (!!this.buOnStart) {
126-
settings.manager.on('start', this.buOnStart);
152+
settings.manager.on('start', onStart);
127153
}
128154

129155
if (!!this.buOnPause) {
130-
settings.manager.on('pause', this.buOnPause);
156+
settings.manager.on('pause', onPause);
131157
}
132158

133159
if (!!this.buOnProgress) {
134-
settings.manager.on('progress', this.buOnProgress);
160+
settings.manager.on('progress', onProgress);
135161
}
136162

137163
if (!!this.buOnInvalid) {
138-
settings.manager.on('invalud', this.buOnInvalid);
164+
settings.manager.on('invalud', onInvalid);
139165
}
140166

141167
if (!!this.buOnQueue) {
142-
settings.manager.on('queue', this.buOnQueue);
168+
settings.manager.on('queue', onQueue);
143169
}
144170
};
145171

146172
this.$onDestroy = function() {
147173
if (!!this.buOnComplete) {
148-
settings.manager.off('complete', this.buOnComplete);
174+
settings.manager.off('complete', onComplete);
149175
}
150176

151177
if (!!this.buOnError) {
152-
settings.manager.off('error', this.buOnError);
178+
settings.manager.off('error', onError);
153179
}
154180

155181
if (!!this.buOnFileStart) {
156-
settings.manager.off('file_start', this.buOnFileStart);
182+
settings.manager.off('file_start', onFileStart);
157183
}
158184

159185
if (!!this.buOnStart) {
160-
settings.manager.off('start', this.buOnStart);
186+
settings.manager.off('start', onStart);
161187
}
162188

163189
if (!!this.buOnPause) {
164-
settings.manager.off('pause', this.buOnPause);
190+
settings.manager.off('pause', onPause);
165191
}
166192

167193
if (!!this.buOnProgress) {
168-
settings.manager.off('progress', this.buOnProgress);
194+
settings.manager.off('progress', onProgress);
169195
}
170196

171197
if (!!this.buOnInvalid) {
172-
settings.manager.off('invalud', this.buOnInvalid);
198+
settings.manager.off('invalud', onInvalid);
173199
}
174200

175201
if (!!this.buOnQueue) {
176-
settings.manager.off('queue', this.buOnQueue);
202+
settings.manager.off('queue', onQueue);
177203
}
178204
};
179205
}],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-batchupload",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "A wrapper module to angular for the batchupload library",
55
"main": "ng-batchupload.js",
66
"scripts": {

0 commit comments

Comments
 (0)