Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.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
Javascript 索引在角度JS中不起作用_Javascript_Angularjs_Ng Repeat - Fatal编程技术网

Javascript 索引在角度JS中不起作用

Javascript 索引在角度JS中不起作用,javascript,angularjs,ng-repeat,Javascript,Angularjs,Ng Repeat,我试图在fileupload中获取onchange的值,以便在controller中使用 <span id="ind">{{$index}}</span> <input id="PhotoPicker" type="file" accept="image/*" capture="camera" title="{{JobDetail.Id}}" alt="{{$index}}" onchange="angular.element(this).scope().f

我试图在fileupload中获取onchange的值,以便在controller中使用

  <span id="ind">{{$index}}</span>
  <input id="PhotoPicker" type="file" accept="image/*" capture="camera" title="{{JobDetail.Id}}" alt="{{$index}}" onchange="angular.element(this).scope().file_changed(this)" /></div>

请帮帮我

我猜angular只会给你文件属性,因为你的输入是file类型的。您应该对others属性使用angular.attr(),请参见

顺便说一下,我认为:

onchange="angular.element(this).scope().file_changed(this)"
可以重写为:

onchange="file_changed(this)"

您可以考虑使用这个模块:

$索引将只与NG重复中的NG重复一起工作,这就是为什么索引在跨度中工作的原因。谢谢您的回复。但在这里,标题和跨度很好。我的目的是采用该索引而不是alt。请给我一个angular.attr()的示例。
onchange="file_changed(this)"