title: Insert data to table row using Angular
body: <p>I am new to angular, and currently working on my personal project.
  I have a question about how to insert new data to table row. 
  Can anyone give me snippet/example how to do this?</p>
  
  <p>Here is the form and the table headers:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!--app.component.html--&gt;
  
  &lt;!--show modal--&gt;
  &lt;a href="#" (click)="smModal.show()" popover="Tambah Data Mhs" placement="bottom" triggers="mouseenter:mouseleave"&gt;ADD&lt;/a&gt;
  
  &lt;!--Modal--&gt;
  &lt;div class="container"&gt;
      &lt;div bsModal #smModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" id="myModal"&gt;
          &lt;div class="modal-dialog modal-sm"&gt;
            &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                &lt;h4 class="modal-title pull-left"&gt;Add&lt;/h4&gt;
                &lt;button type="button" class="close pull-right" aria-label="Close" (click)="smModal.hide()"&gt;
                  &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                &lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                &lt;form&gt;
                  &lt;label&gt;ID&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="id"&gt;
  
                  &lt;label&gt;name&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="name"&gt;
  
                  &lt;label&gt;year&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="year"&gt;
  
                  &lt;label&gt;major&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="major"&gt;
  
                  &lt;label&gt;address&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="address"&gt;
  
                  &lt;label&gt;Email&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="email"&gt;
  
                  &lt;label&gt;phone&lt;/label&gt;
                  &lt;input type="text" class="form-control" placeholder="phone"&gt;&lt;br&gt;
                  
                  &lt;button type="submit" class="btn btn-primary"&gt;Simpan&lt;/button&gt;
                  &lt;button class="btn btn-danger"&gt;Batal&lt;/button&gt;
                &lt;/form&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  &lt;!--enf of modal--&gt;
  
  &lt;!--table--&gt;
  &lt;div class="container"&gt;
    &lt;table class="table table-responsive table-striped"&gt;
      &lt;tr&gt;
        &lt;th&gt;id&lt;/th&gt;
        &lt;th&gt;name&lt;/th&gt;
        &lt;th&gt;year&lt;/th&gt;
        &lt;th&gt;major&lt;/th&gt;
        &lt;th&gt;address&lt;/th&gt;
        &lt;th&gt;email&lt;/th&gt;
        &lt;th&gt;phone&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;div&gt;
  &lt;!--end of table--&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the typescript file:</p>
  
  <pre class="lang-js prettyprint-override"><code>//app.component.ts
  
  import { Component } from '@angular/core';
  import { TemplateRef } from '@angular/core';
  import { BsModalService } from 'ngx-bootstrap/modal';
  import { BsModalRef } from 'ngx-bootstrap/modal/modal-options.class';
  import { NgIf } from '@angular/common';
  
   @Component({
    selector: 'app-root',
    styleUrls:['app.component.css'],
    templateUrl:'app.component.html',
    //template:`&lt;h1 align="center"&gt;template&lt;/h1&gt;`
  })
  
  export class AppComponent 
  {
    title = 'title';
  
  }
  </code></pre>
  
  <p>What I need to do is simply insert the user input from that from into a table row. 
  Please let me know if more snippets are needed.</p>