title: Update function in Angular
body: <p>This is my app.component.ts file where I have created my add and delete functions </p>
  
  <pre><code>export class AppComponent 
  {   
     title = 'organizer';
     items = [];  
     newItem = '';
  
     pushItem = function() {
         if (this.newItem !== ''){
             this.items.push(this.newItem);
             this.newItem = '';
           }   
     };
  
    removeItem = function(index){
      this.items.splice(index, 1);
    };
  }
  </code></pre>
  
  <p>This is the html file where I have used the above methods</p>
  
  <pre><code>&lt;div&gt;
    &lt;h1&gt;Item's List&lt;/h1&gt;
    &lt;div class="addItem"&gt;
      &lt;input [(ngModel)] = "newItem" placeholder="Add Item" class="addText"&gt;
      &lt;button (click)="pushItem()"&gt;Add&lt;/button&gt;
    &lt;/div&gt;
    &lt;ul&gt;
      &lt;li *ngFor="let i of items; let ind = index"&gt;
        {{i}}
        &lt;span&gt;update&lt;/span&gt;
        &lt;span (click)="removeItem(ind)"&gt;x&lt;/span&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to add a update method to this application.The entered data should be displayed in the input panel when update is clicked and after updating and clicking the add button the data should be updated . </p>