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