title: Not able to find correct indexOf value by clicking an array element
body: <p>My code for html and js are as:</p>
  
  <h2>html</h2>
  
  <pre><code>&lt;img ng-repeat = "x in images" ng-src = "{{x.url}}" ng-click = "mag(x)"&gt;
  </code></pre>
  
  <h2>js</h2>
  
  <pre><code>$scope.images = [img1, img2, img3, img4] 
  var l;
  $scope.mag = function(x){
    l = $scope.images.indexOf(x);
    console.log("value of l "+l);
  }
  </code></pre>
  
  <p><code>img1, img2...</code> are dummy objects in which their ulrs exist. </p>
  
  <p>As I click over <code>first image</code>, in <code>console.log()</code> it is showing <code>value of l is 0</code> which is <code>correct</code> but on clicking <code>2nd</code> image, value of <code>l is again 0 instead of 1</code>, on clicking  <code>3rd</code> image value of <code>l is 1 instead of 2</code> and on clicking  <code>4th</code> image value of <code>l is 2 instead of 3</code>.</p>