title: How to get index inside ng-repeat with file input?
body: <p>I have an array of records which I upload using file input. My purpose is to upload a file in a row when '+' is clicked and remove the file when 'x' is clicked.</p>
  
  <p>My issue is, whenever I upload one file in one record, all other records are also get updated by the same file. I'm sure that I'm missing to use the <code>$index</code> logic here. I'm already passing <code>this</code> with <code>onchange</code> event of file input. How can I pass <code>$index</code> along with that?</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div ng-repeat="itemList in FilesToShow track by $index"&gt;
      &lt;div style="width: 90%; display: inline-block;"&gt;{{itemList.FileName}}&lt;/div&gt;
      &lt;div style="cursor:pointer;display: inline-block;"
           ng-click="removefile(itemList)"&gt;x&lt;/div&gt;
      &lt;div style="cursor:pointer;display: inline-block;"
           ng-focus="$parent.focused = true" ng-if="FilesToShow.length==0"&gt;+&lt;/div&gt;
  &lt;/div&gt;
  &lt;input ng-if="focused" ng-disabled="FilesToShow.length==1" type="file"
         id="fileId" value="Browse..." name="file"
         onchange="angular.element(this).scope().getFileDetails(this)" /&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>$scope.FilesToShow = [];
  $scope.getFileDetails = function(hisLstFile) {
    $scope.$apply(function() {
      var Historyvalue = {
        FileName: hisLstFile.files[0].name,
        IsFileDeleted: false,
        DownloadPath: null,
        Id: null
      };
      $scope.FilesToShow.push(Historyvalue);
    });
  }
  </code></pre>