Skip to content

Commit ed86eca

Browse files
committed
Merge pull request danialfarid#168 from a5hik/master
Removed unused $rootScope, $http reference from fileUpload Service and Directives.
2 parents bb2d189 + a43e81e commit ed86eca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

demo/war/js/angular-file-upload.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
var angularFileUpload = angular.module('angularFileUpload', []);
99

10-
angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', function($http, $rootScope, $timeout) {
10+
angularFileUpload.service('$upload', ['$http', '$timeout', function($http, $timeout) {
1111
function sendHttp(config) {
1212
config.method = config.method || 'POST';
1313
config.headers = config.headers || {};
@@ -66,20 +66,21 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
6666
})(promise, promise.then);
6767

6868
return promise;
69-
};
69+
}
7070
this.upload = function(config) {
7171
config.headers = config.headers || {};
7272
config.headers['Content-Type'] = undefined;
7373
config.transformRequest = config.transformRequest || $http.defaults.transformRequest;
7474
var formData = new FormData();
75+
var i;
7576
if (config.data) {
7677
for (var key in config.data) {
7778
var val = config.data[key];
7879
if (!config.formDataAppender) {
7980
if (typeof config.transformRequest == 'function') {
8081
val = config.transformRequest(val);
8182
} else {
82-
for (var i = 0; i < config.transformRequest.length; i++) {
83+
for (i = 0; i < config.transformRequest.length; i++) {
8384
var fn = config.transformRequest[i];
8485
if (typeof fn == 'function') {
8586
val = fn(val);
@@ -98,7 +99,7 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
9899

99100
if (Object.prototype.toString.call(config.file) === '[object Array]') {
100101
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
101-
for (var i = 0; i < config.file.length; i++) {
102+
for (i = 0; i < config.file.length; i++) {
102103
formData.append(isFileFormNameString ? fileFormName + i : fileFormName[i], config.file[i], config.file[i].name);
103104
}
104105
} else {
@@ -114,7 +115,7 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
114115
}
115116
}]);
116117

117-
angularFileUpload.directive('ngFileSelect', [ '$parse', '$http', '$timeout', function($parse, $http, $timeout) {
118+
angularFileUpload.directive('ngFileSelect', [ '$parse', '$timeout', function($parse, $timeout) {
118119
return function(scope, elem, attr) {
119120
var fn = $parse(attr['ngFileSelect']);
120121
elem.bind('change', function(evt) {
@@ -138,7 +139,7 @@ angularFileUpload.directive('ngFileSelect', [ '$parse', '$http', '$timeout', fun
138139
};
139140
} ]);
140141

141-
angularFileUpload.directive('ngFileDropAvailable', [ '$parse', '$http', '$timeout', function($parse, $http, $timeout) {
142+
angularFileUpload.directive('ngFileDropAvailable', [ '$parse', '$timeout', function($parse, $timeout) {
142143
return function(scope, elem, attr) {
143144
if ('draggable' in document.createElement('span')) {
144145
var fn = $parse(attr['ngFileDropAvailable']);
@@ -149,7 +150,7 @@ angularFileUpload.directive('ngFileDropAvailable', [ '$parse', '$http', '$timeou
149150
};
150151
} ]);
151152

152-
angularFileUpload.directive('ngFileDrop', [ '$parse', '$http', '$timeout', function($parse, $http, $timeout) {
153+
angularFileUpload.directive('ngFileDrop', [ '$parse', '$timeout', function($parse, $timeout) {
153154
return function(scope, elem, attr) {
154155
if ('draggable' in document.createElement('span')) {
155156
var cancel = null;

0 commit comments

Comments
 (0)