javascript - Index not working in angular JS -


im trying values onchange in fileupload use in 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> 

here,in span ind cant able row index. when use in alt not working. can able title too. in alt shows zero.

 $scope.file_changed = function (element) {     debugger;      var filesselected = element.files;     var jobdetailid = element.title; //working     var index = element.alt; //not working    }; 

kindly me!

my guess angular give files attribute because input of type file. should use angular.attr() others attribute, see https://docs.angularjs.org/api/ng/function/angular.element

by way think :

onchange="angular.element(this).scope().file_changed(this)" 

can rewritten :

onchange="file_changed(this)" 

you might consider using module : https://github.com/danialfarid/ng-file-upload


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -