title: How update list in AngularJS?
body: <p>I created one TODO List in AngularJS but I didn't finish the update function. I have some difficulty.</p>
  
  <p>How do I create the update function?</p>
  
  <p>Link: <a href="https://plnkr.co/edit/XfWoGVrEBqSl6as0JatS?p=preview" rel="nofollow">https://plnkr.co/edit/XfWoGVrEBqSl6as0JatS?p=preview</a></p>
  
  <pre><code>&lt;ul class="list-todo"&gt;
          &lt;li ng-repeat="t in tasks track by $index"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="six columns"&gt;
                      &lt;p&gt;{{ t }}&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;div class="three columns"&gt;
                      &lt;button class="button" ng-click="update()"&gt;update&lt;/button&gt;
                  &lt;/div&gt;
                  &lt;div class="three columns"&gt;
                      &lt;button class="button" ng-click="delete()"&gt;x&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>Angular Code:</p>
  
  <pre><code>angular.module('todoTest', [])
  .controller('todoController', function($scope) {
      $scope.tasks = [];
      $scope.add = function() {
        $scope.tasks.push($scope.dotask);
      }
      $scope.update = function(){
          $apply.tasks.push($scope.dotask);
      }
      $scope.delete = function() {
        $scope.tasks.splice(this.$index, 1);
      }
  })
  </code></pre>