title: Set value of input depending on element clicked in Angular
body: <p>I have made the  following plunker:</p>
  
  <p><a href="https://plnkr.co/edit/Ff2O2TGC4WLaD62fJmvA?p=preview" rel="nofollow">https://plnkr.co/edit/Ff2O2TGC4WLaD62fJmvA?p=preview</a></p>
  
  <p>I would like the value of the input to be the <code>item.name</code> clicked.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;body ng-app="myApp"&gt;
  
  &lt;div ng-controller="MyController"&gt;
    &lt;ul ng-repeat="item in collection"&gt;
      &lt;li ng-click="edit('{{item.name}}')"&gt;{{item.name}}&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
    &lt;input  name="myinput" ng-model="myinput"  /&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>Js:</p>
  
  <pre><code>var app = angular.module('myApp', [])
  
  .controller('MyController', function($scope, $http) {
  
    $scope.collection = [
        {name:'foo'},
        {name:'bar'},
        {name:'foobar'},
        {name:'barfoo'},
      ];
  
    $scope.edit = function(current_name) {
  
      this.myinput = current_name;
  
      console.log(current_name);
  
    }
  
  })
  </code></pre>