AngularJS and papaParse Integration

2019-06-09 00:53发布

My form is this

<form name="form-basic" class="form-validation" ng-submit="uploadFile(updFrm.file)">
<input type="file" class="form-control" name="filee" id="files" ng-model="updFrm.file"/>
<input type="submit" value="click" class="btn btn-default">
</form>

I want to Pass Value of Input "file" into papaParse

Papa.parse(fileInput.files[0], {
    complete: function(results) {
        console.log(results);
    }
});

Now how to replace fileInput.files[0] with Value from " <input type="file" class="form-control" id="files" ng-model="updFrm.file"/>"

Please guide...

1条回答
女痞
2楼-- · 2019-06-09 01:43

Try to Change $scope.updFrm.file instead of fileInput.files[0]

//Or

in your function via

$scope.uploadFile = function(fileDetails)
{
  Papa.parse(fileDetails, {
    complete: function(results) {
        console.log(results);
    }
 });
}
查看更多
登录 后发表回答