Skip to content

Commit af0c7fd

Browse files
committed
2 parents 7400f06 + d6e3711 commit af0c7fd

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

dist/angular-csv-import.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-csv-import - v0.0.15 - 2015-04-08
1+
/*! angular-csv-import - v0.0.16 - 2015-05-12
22
* Copyright (c) 2015 ; Licensed */
33
'use strict';
44

@@ -34,6 +34,7 @@ csvImport.directive('ngCsvImport', function() {
3434

3535
element.on('change', function(onChangeEvent) {
3636
var reader = new FileReader();
37+
scope.filename = onChangeEvent.target.files[0].name;
3738
reader.onload = function(onLoadEvent) {
3839
scope.$apply(function() {
3940
var content = {
@@ -44,8 +45,10 @@ csvImport.directive('ngCsvImport', function() {
4445

4546
scope.content = content.csv;
4647
scope.result = csvToJSON(content);
48+
scope.result.filename = scope.filename;
4749
});
4850
};
51+
4952
if ( (onChangeEvent.target.type === "file") && (onChangeEvent.target.files != null || onChangeEvent.srcElement.files != null) ) {
5053
reader.readAsText((onChangeEvent.srcElement || onChangeEvent.target).files[0]);
5154
} else {

dist/angular-csv-import.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/angular-csv-import.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ csvImport.directive('ngCsvImport', function() {
1212
header: '=',
1313
headerVisible: '=',
1414
separator: '=',
15+
separatorVisible: '=',
1516
result: '='
1617
},
17-
template: '<div><div ng-show="header && headerVisible"><div class="label">Header</div><input type="checkbox" ng-model="header"></div>'+
18-
'<div ng-show="separator" ><div class="label">Seperator</div><input type="text" ng-change="changeSeparator" ng-model="separator"></div>'+
18+
template: '<div><div ng-show="headerVisible"><div class="label">Header</div><input type="checkbox" ng-model="header"></div>'+
19+
'<div ng-show="separatorVisible" ><div class="label">Seperator</div><input type="text" ng-change="changeSeparator" ng-model="separator"></div>'+
1920
'<div><input class="btn cta gray" type="file"/></div></div>',
2021
link: function(scope, element) {
2122
element.on('keyup', function(e){
@@ -32,6 +33,7 @@ csvImport.directive('ngCsvImport', function() {
3233

3334
element.on('change', function(onChangeEvent) {
3435
var reader = new FileReader();
36+
scope.filename = onChangeEvent.target.files[0].name;
3537
reader.onload = function(onLoadEvent) {
3638
scope.$apply(function() {
3739
var content = {
@@ -42,8 +44,10 @@ csvImport.directive('ngCsvImport', function() {
4244

4345
scope.content = content.csv;
4446
scope.result = csvToJSON(content);
47+
scope.result.filename = scope.filename;
4548
});
4649
};
50+
4751
if ( (onChangeEvent.target.type === "file") && (onChangeEvent.target.files != null || onChangeEvent.srcElement.files != null) ) {
4852
reader.readAsText((onChangeEvent.srcElement || onChangeEvent.target).files[0]);
4953
} else {

0 commit comments

Comments
 (0)