title: changing the button value on ng-click using angularjs
body: <p>I am having a list of item with me, which I displayed using <strong>ng-repeat</strong>. </p>
  
  <pre><code>&lt;div ng-controller="MyCtrl"&gt;
     &lt;div ng-repeat = "item in items"&gt;
        item-{{item}} &lt;button ng-click = 'addThis(item)'&gt;add to list&lt;/button&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When the user click on the button <strong>add to list</strong> it will add the item to the another list. After adding that I want the button value to be <strong>added to list</strong>, and the button ng-click function should be removed. </p>
  
  <p><em>The controller</em></p>
  
  <pre><code>function MyCtrl($scope) {
    $scope.items = [1,2,3,4,5,6,7,8,9,10,11,12,13];
    $scope.addedItems = [];
    $scope.addThis=function(item){
      var added = false;
      for(var i=0;i&lt;$scope.addedItems.length;i++){
          if($scope.addedItems[i] === item){
              added = true;
              break;
          }
      }
      if(!added){
          $scope.addedItems.push(item);
          // here i want something to change the button
          console.log($scope.addedItems);
          }
      else{
          alert("already added");
          }       
     }
  }
  </code></pre>
  
  <p>Can somebody please show me how to change the button value if the item is already added to the list.</p>
  
  <p>I am attaching a <a href="http://jsfiddle.net/muralicse/yf4gbhp5/" rel="nofollow">fiddle</a> here.</p>