我得到这个插件来上传图片:Angular File Plugin
我需要当我输入一个新文件时,它为每个文件创建一个表单,其中包含我想随文件一起发送的一些字段。我可以使用以下回调来做到这onAfterAddingFile
一点:
uploader.onAfterAddingFile = function(fileItem) {
var f = document.createElement("form");
f.setAttribute('method',"post");
f.setAttribute('action',"submit.php");
var i = document.createElement("input"); //input element, text
i.setAttribute('type',"text");
i.setAttribute('name',"title");
f.appendChild(i);
document.getElementById("myForm").appendChild(f);
但是现在,我需要将每个图像与每个表单链接起来。我认为我需要创建一个自定义属性,data-frm
例如链接它们,不是吗?我怎样才能做到这一点?