From 740dbcd8b24d746c708cfdb980fac4dbadd1395b Mon Sep 17 00:00:00 2001 From: ronysilvati Date: Tue, 1 Aug 2017 09:47:21 -0300 Subject: [PATCH] New feacture: Import same csv file again; When a user selects the same file, the event "change" is not fired. A new attribute has added in directive: lockImportSameFile. If this is true, the directive works like today, if attr is "undefined" or "false", this directive removes the value from input [type = "file"] and unlock the "change" event. --- dist/angular-csv-import.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dist/angular-csv-import.js b/dist/angular-csv-import.js index 8ced37e..e4306ff 100644 --- a/dist/angular-csv-import.js +++ b/dist/angular-csv-import.js @@ -26,7 +26,8 @@ csvImport.directive('ngCsvImport', function() { mdInputClass: '@?', mdButtonTitle: '@?', mdSvgIcon: '@?', - uploadButtonLabel: '=' + uploadButtonLabel: '=', + lockImportSameFile:'=?' }, template: function(element, attrs) { var material = angular.isDefined(attrs.material); @@ -143,6 +144,10 @@ csvImport.directive('ngCsvImport', function() { }); } } + + if(!scope.lockImportSameFile){ + angular.element(document).find('.ng-csv-import.ng-isolate-scope input[type="file"]')[0].value = null; + } }); var csvToJSON = function(content) {