Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在角文件上传中,如何在删除之前获取文件索引?_Angularjs - Fatal编程技术网

Angularjs 在角文件上传中,如何在删除之前获取文件索引?

Angularjs 在角文件上传中,如何在删除之前获取文件索引?,angularjs,Angularjs,我用。我有一个事件ng click=“removeFile(item)” 角JS: $scope.removeFile = function (item){ console.log(item); } 对象项中有索引参数对于我来说是空的。如何在删除之前获取当前文件的索引?如图所示,他们使用图像列表中的ng click=“item.remove()”,然后使用getIndexOfItem获取文件列表中的索引。但在包装器removeFile中,您可以使用如下smth: $scope.remov

我用。我有一个事件
ng click=“removeFile(item)”

角JS:

$scope.removeFile = function (item){
   console.log(item);
}
对象
中有
索引
参数
对于我来说是空的。如何在删除之前获取当前文件的索引?

如图所示,他们使用图像列表中的
ng click=“item.remove()”
,然后使用
getIndexOfItem
获取文件列表中的索引。但在包装器
removeFile
中,您可以使用如下smth:

$scope.removeFile = function (item){
   item.remove();
  //index of the file in the list is - item.$index
    }