I am trying to read a csv file in angular js and i got through this question How to read csv file content in angular js? where it is used as directive.But i am submitting it as a form in my controler ,so how can i use in my form.Can anyone suggest help.Thanks.
My code,
if($scope.partner.csv){
var files = $scope.partner.csv.target.files
var r = new FileReader();
r.onload = function(e) {
var contents = e.target.result;
$scope.$apply(function () {
$scope.fileReader = contents;
});
};
}
}
This is what i had tried,when i submit my form if csv file is uploaded the above action should be done.