AngularJS和papaParse集成 [英] AngularJS and papaParse Integration

查看:181
本文介绍了AngularJS和papaParse集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单是这个

<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>

我想将输入文件"的值传递给papaParse

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

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

现在如何用"<input type="file" class="form-control" id="files" ng-model="updFrm.file"/>"中的值替换fileInput.files [0]

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

请指导...

推荐答案

尝试更改$scope.updFrm.file而不是fileInput.files[0]

//或

在您的功能中通过

$scope.uploadFile = function(fileDetails)
{
  Papa.parse(fileDetails, {
    complete: function(results) {
        console.log(results);
    }
 });
}

这篇关于AngularJS和papaParse集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆