0

I have a JSON file in my HDD, how can I read the content of this file when I select it with input field?

I have to read the content and send content as data in some API!

I need something like this :

<input type="file" id="dashboardExportedFile">
<button type="button" ng-click="importDashboard">Import</button>
<script>
  $scope.importDashboard = function (
    var content = $("#dashboardExportedFile").content
    console.log(content);
  };
</script>
Kalagar
  • 379
  • 2
  • 6
  • 18
  • Take a look at this Stackoverflow question, it may provide you with the answer you're looking for: https://stackoverflow.com/questions/18571001/file-upload-using-angularjs – Chris Jan 25 '19 at 16:58

1 Answers1

1

I think you need a Filereader. Follow my Link to see an working example with .txt File. Hope u can use it: [JSFiddle][1]

[1]: http://jsfiddle.net/alexsuch/6aG4x/
Daniel Richter
  • 768
  • 5
  • 23