title: Button inside ng-repeat to update input in form
body: <p>What I am trying to do is update an input field from within an ng-repeat. I have an ng-click on the button inside the ng-repeat for each user. When clicking on the button it should update the value of the input field which is outside the ng-repeat but in the same controller. I have just started using Angularjs and I seem to be missing something simple here, but just can't figure it out. Any help is greatly appreciated!</p>
  
  <pre><code>&lt;div ng-app="MyApp"&gt;
      &lt;div ng-controller="Main"&gt;
          &lt;form name="myForm"&gt;
              &lt;input type="email" ng-model="rootFolders"&gt;
              &lt;button type="submit"&gt;Submit&lt;/button&gt;
          &lt;/form&gt; 
          &lt;span ng-repeat="user in users" style="float:left"&gt;
              {{user.name}}&lt;br&gt;
              &lt;button ng-click="rootFolders='{{user.login}}'"&gt;Load Email&lt;/button&gt;
          &lt;/span&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>angular.module('MyApp', []);
  
  function Main($scope) {
      $scope.rootFolders = 'bob@go.com';
      $scope.users = [
              {id:0,name:'user1',login:'user1@go.com',password:'123456'},
              {id:1,name:'user2',login:'user2@go.com',password:'123456'},
                      ]
  }
  </code></pre>
  
  <p>Here is the fiddle: <a href="http://jsfiddle.net/DahDC/" rel="nofollow">http://jsfiddle.net/DahDC/</a></p>