title: Can I set a variable inside ng-repeat?
body: <p>I have an application that has two forms that are lists of buttons and a form with a list of labels. I choose a person, choose a phone, and on the third form I show a list of phones and their associated people (location). Is it possible to set a variable with <code>ng-click</code> inside an <code>ng-repeat</code> block? I tried settings a variable _person to be equal to the the button text, which would be <code>{{person}}</code>, but _person doesn't seem to be set to anything when I print it on the next form. I'm also not sure if I used <code>ng-init</code> correctly in the first <code>&lt;div&gt;</code>, and should I be using <code>ng-model</code> at all?</p>
  
  <pre><code>&lt;div ng-init="showSelectUser=true; _person=''"&gt;
  &lt;div class="selectUser" ng-show="showSelectUser"&gt;
      &lt;h2&gt;Who are you?&lt;/h1&gt;
      &lt;ul ng-click="showSelectUser=false; showDeviceForm=true;"&gt;
        &lt;li ng-repeat="person in people"&gt;
          &lt;a href="#" role="button" ng-click="_person={{person}}"&gt;{{person}}&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  
    &lt;div class="selectDevice" ng-show="showDeviceForm" ng-click="showDeviceForm=false; showDeviceList=true"&gt;
      &lt;p&gt;person: {{_person}}&lt;/p&gt;
      &lt;h2&gt;Which phone?&lt;/h2&gt;
      &lt;ul&gt;
        &lt;li ng-repeat="device in devices"&gt;
          &lt;a class="btn btn-default" href="#" role="button" ng-click="device.location=_person"&gt;{{device.name}}&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  
    &lt;div class="devicesView" ng-show="showDeviceList"&gt;
      &lt;ul&gt;
        &lt;li ng-repeat="device in devices"&gt;
          &lt;h3&gt;{{device.name}}&lt;/h3&gt;
          &lt;h4 class="deviceLocation"&gt;{{device.location}}&lt;/h4&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  
  
  angular.module('devicesApp')
    .controller('MainCtrl', function ($scope) {
      $scope.devices = [
          {name: 'iPhone 4', location: 'Desk'},
          {name: 'iPhone 5', location: 'Desk'},
          {name: 'iPhone 6', location: 'Desk'},
      ];
  
      $scope.people = [
          'John',
          'Scott',
          'Adam'
      ];
  });
  </code></pre>