在AngularJS中上传文件而无需提交按钮 [英] Uploading File in AngularJS without submit button

查看:76
本文介绍了在AngularJS中上传文件而无需提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有提交按钮的情况下提交文件时,angularjs的最佳做法是什么? 这是我的示例代码.

What is the best practices in angularjs when submitting file without a submit button. Here is my sample code.

<form method="post" enctype="multipart/form-data" action="">
   <input type="file" name="file">
</form>

我已经尝试使用onchange,它也非常有用,但是我想要的是选择文件后将进行ajax调用(没有提交按钮).

I already tried using onchange, very useful also but what i want is after selecting a file it will make an ajax call (without submit button).

推荐答案

我已经使用了ngpload模块.

i have used ngpload module for it.

ngpload

请参考链接中的文档,这肯定会对您有很大帮助

please refer the document from the link this will definitely help you a lot

这篇关于在AngularJS中上传文件而无需提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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