I am generating a list as below
<div ng-repeat="list in fileUploadList">
<div id="{{list}}Upload"></div>
</div>
Inside the controller I have to get the element by ID so I am using this line:
document.getElementById($scope.fileUploadList[0] + 'Upload')
I logged the result to the console but it is returning null
. What should I do?
Function in controller
$scope.loadHandleImage = function () {
console.log(document.getElementsById($scope.fileUploadList[0] + 'Upload'));
for (var i = 0; i < $scope.fileUploadList.length; i++)
{
document.getElementById($scope.fileUploadList[i] + 'Upload').addEventListener('change', handleImage, false);
}
where handleImage
is a function to be called