在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