Patrick Patrick - 2 years ago 110
AngularJS Question

csv import only when save button is clicked (Plunker added)

Here is the Plunker.

as per this plunker, user selects a csv file. once file is selected, its content get displayed below it. its due to {{fileContent}} mentioned in the HTML code.

Instead of directly displaying below, i want user to click on save button. Once save button is clicked, i want the result to be displayed in console log instead of just below the select file button.

</html> //added this code so it allows me to post the question.

Any idea how to achieve this ?

Answer Source

Pass fileContent to save() function


<body ng-controller="MainCtrl">
    <p>Hello {{name}}!</p>
    <input type="file" file-reader="fileContent" />
    <button type="button" ng-click="save(fileContent);">Save</button>


$ = function(data)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download