title: angular for loop returns last value
body: <p>I believe this is a pretty simple question and I have found some solutions here on forum but it looks that I did everything right but still getting only last value. I've wrote this simple <strong><a href="http://plnkr.co/edit/rlmbLz2TUFiqRy0kKa46" rel="nofollow">example</a></strong>. Somebody could explain me, where is my mistake?</p>
  
  <pre><code>var app = angular.module('plunker', []);
  
  app.controller('MainCtrl', function($scope, $http) {
    $scope.name = 'Reinforcement';
  
                      $http.get('test.json')
                          .success(function (data) {
                              $scope.test = data;
                          });
  
  
        $scope.getName = function () {
              for (var i = 0; i &lt; $scope.test.length; i++) {
                 $scope.parent = $scope.test[i].name
              }
           }
  });
  </code></pre>
  
  <p>html </p>
  
  <pre><code>   &lt;div class="dropdown category" style="position:relative"&gt;
                                      &lt;a href="#" class="btn btn-default dropdown-toggle" data-toggle="dropdown"&gt; Category &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                                  &lt;li ng-repeat="objName in test" ng-click="getName()"&gt;
                                                      &lt;a href=""&gt; {{objName.name}}&lt;/a&gt;
                                                  &lt;/li&gt;
                                              &lt;/ul&gt;
                                  &lt;/div&gt;
  
                                  {{ parent }}
  </code></pre>