angular-file-reader-module
Advanced tools
Comparing version 1.1.0 to 1.2.0
angular.module('angular-file-reader', []) | ||
.service('requestTransformers', [function () { | ||
this.transformToFormData = function (data, getHeaders) { | ||
function appendFormData(formData, key, value) { | ||
if (value instanceof window.File) { | ||
formData.append(key, value, value.name); | ||
return; | ||
} | ||
if (value instanceof window.Blob) { | ||
formData.append(key, value, key + '.png'); | ||
return; | ||
} | ||
if (typeof value !== 'undefined') { | ||
formData.append(key, value); | ||
return; | ||
} | ||
} | ||
var formData = new window.FormData(); | ||
angular.forEach(data, function (value, key) { | ||
if (value instanceof Array) { | ||
for (var i = 0; i < value.length; i++) { | ||
appendFormData(formData, key + '[' + i + ']', value[i]); | ||
} | ||
} else { | ||
appendFormData(formData, key, value); | ||
} | ||
}); | ||
return formData; | ||
}; | ||
}]) | ||
.directive('fileread', [function () { | ||
@@ -3,0 +36,0 @@ return { |
@@ -1,23 +0,1 @@ | ||
'use strict'; | ||
angular.module('angular-file-reader', []).directive('fileread', [function () { | ||
return { | ||
scope: { | ||
fileread: '=' | ||
}, | ||
link: function link(scope, element, attrs) { | ||
element.bind('change', function (changeEvent) { | ||
scope.$apply(function () { | ||
scope.fileread = changeEvent.target.files[0]; | ||
console.log(changeEvent); | ||
if (attrs.fileChangedHandler) { | ||
angular.element(element).scope()[attrs.fileChangedHandler](scope.fileread); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
}]); | ||
//# sourceMappingURL=angular-file-reader.js.map | ||
"use strict";angular.module("angular-file-reader",[]).service("requestTransformers",[function(){this.transformToFormData=function(e,n){function a(e,n,a){return a instanceof window.File?void e.append(n,a,a.name):a instanceof window.Blob?void e.append(n,a,n+".png"):void 0!==a?void e.append(n,a):void 0}var i=new window.FormData;return angular.forEach(e,function(e,n){if(e instanceof Array)for(var r=0;r<e.length;r++)a(i,n+"["+r+"]",e[r]);else a(i,n,e)}),i}}]).directive("fileread",[function(){return{scope:{fileread:"="},link:function(e,n,a){n.bind("change",function(i){e.$apply(function(){e.fileread=i.target.files[0],console.log(i),a.fileChangedHandler&&angular.element(n).scope()[a.fileChangedHandler](e.fileread)})})}}}]); |
@@ -1,11 +0,1 @@ | ||
'use strict'; | ||
var gulp = require('gulp'); | ||
var uglify = require('gulp-uglify'); | ||
gulp.task('uglify-js', function (done) { | ||
return gulp.src('dist/**/*.js').pipe(uglify()).pipe(gulp.dest('dist')); | ||
}); | ||
gulp.task('default', ['uglify-js']); | ||
//# sourceMappingURL=gulpfile.js.map | ||
"use strict";var gulp=require("gulp"),uglify=require("gulp-uglify");gulp.task("uglify-js",function(u){return gulp.src("dist/**/*.js").pipe(uglify()).pipe(gulp.dest("dist"))}),gulp.task("default",["uglify-js"]); |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "angular-file-reader-module", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
8437
57
2