I just followed the way mentioned in this article to upload a file https://www.tutorialspoint.com/angularjs/angularjs_upload_file.htm link:
function(scope, element, attrs) {
var model = $parse(attrs.fileModel);
var modelSetter = model.assign;
element.bind('change', function(){
scope.$apply(function(){
console.log("len:"+element[0].files);
modelSetter(scope, element[0].files);
console.log("filenames:"+element[0].files);
});
});
Here when I debug the element does not contain any attributes called files, so I always getting it as undefined. I have tried many different ways, all resulted with the same issue. How to solve this issue? Why element doesn't have files attributes?