title: How to push object to a new array with button click on ngFor table in angular 8
body: <p>I how to arrays, one(<code>array1</code>) has some objects while the other(<code>array2</code>) has a list of objects that I want to choose from and push to <code>array1</code>.</p>
  
  <p><strong>.html</strong></p>
  
  <pre><code>&lt;div class="forArray1"&gt;
   &lt;table &gt;
     &lt;tr *ngFor="list1 of array1"&gt;
         &lt;td&gt;{{list1.name}}&lt;/td&gt;
         &lt;td&gt;&lt;button (click)=removeFunction()&gt;Remove&lt;/button&gt;&lt;td&gt;
      &lt;/tr&gt;
   &lt;table&gt;
  &lt;/div&gt;
  &lt;div class="forArray2"&gt;
    &lt;table &gt;
     &lt;tr *ngFor="list2 of array2"&gt;
     &lt;td&gt;{{list2.name}}&lt;/td&gt;
     &lt;td&gt;&lt;button (click)=addFunction()&gt;Add&lt;/button&gt;&lt;td&gt;
     &lt;/tr&gt;
   &lt;table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How to push the row object from arry2 list to arry1 list after clicking on the "Add" button on a specific object? Something like get by ID and push.</p>
  
  <p><strong>json</strong></p>
  
  <pre><code>array1 = [
      {
       "type": "toyota", 
       "year": "2013"
      }]
  
  ***************************************
  
  array2 = [
      {
       "type": "toyota", 
       "year": "2013"
      },
      {
       "type": "audi", 
       "year": "2010"
      },
      {
       "type": "honda", 
       "year": "2014"
      },
      {
       "type": "ford", 
       "year": "2018"
      }]
  </code></pre>
  
  <p><strong>.ts</strong></p>
  
  <pre><code>array1 = [];
  array2 = [];
  
  //add an obj to array1 and delete it from array2
  addFunction() {
         //TODO
  }
  
  //it will remove the an obj from array1
  removeFunction(){
        //TODO
  }
  </code></pre>
  
  <p>How to complete the functions? Suggestion on better approach is also fine.</p>