title: Angular 6: HTML table create dynamic columns and rows
body: <p>Using Angular 6 here</p>
  
  <p>I wanted some inputs regarding designing of one of my UI component. So basically the current functionally we had already designed in AngularJs but in this
  new app which is using Angular 6 I wanted to know if there are better ways to do so.</p>
  
  <p>Below is the UI flow I am looking to design.</p>
  
  <p>User fills up a form at the top basically some text boxes and dropdowns.</p>
  
  <p>After the above selection I show up a HTML table having 3 static columns and few buttons for ex as below:</p>
  
  <p>ID  Type  Env   +Add Column
                               -Delete Row
  +Add Row</p>
  
  <p>Above Id, Type and Env are 3 static columns which are always there. Now if the user wants to add more column (dynamic) he can click the Add Column button, where user can enter their own specific name to the column. There should also be functionally of deleting the dynamic columns.
  Once user is done adding columns he can click on Add Row which would create a dynamic row and user can then enter data to the table.
  Once user adds the row, user may click on Delete Row button to delete that row. </p>
  
  <p>After user is done adding columns and rows to the table there is a submit button at the end which would send the above in Json format to my API which would 
  then save the entire form.</p>
  
  <p>FYI I already have a working versions of this in angularjs where I am using contenteditable against each row something as below:</p>
  
  <pre><code>&lt;tr ng-repeat="r in targetTable.rows"&gt;
   &lt;td class="unique-id"&gt;{{r.id}}&lt;/td&gt;
   &lt;td contenteditable="true" ng-repeat="column in targetTable.columns" ng-model="r[column.id]" ng-blur="!r.id? addNewRow(r[column.id], r): undefined"&gt;&lt;/td&gt;
   &lt;td class="blank" colspan="2"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>See the demo here:</p>
  
  <p><a href="https://codepen.io/anon/pen/QXwjwM" rel="nofollow noreferrer">https://codepen.io/anon/pen/QXwjwM</a></p>
  
  <p>What I need inputs is to how to design this html table with all the functionally of adding/deleting dynamic rows and columns in Angular 6. Is there some open source available or if anyone can help me to some examples. Or if I need to create all this manually. in similar way as I did in AngularJs.</p>
  
  <p>Thanks</p>
  
  <p>Anyone with inputs?</p>