Tutorialsplane

AngularJs Add Table Row


AngularJs Add Table Row – It is very easy to add/append a new row in table, Unlike jQuery or other framework you don’t need to put much effort to append new row in table. Here in this tutorial we are going to explain how you can add/append a new table row in AngularJs. You can use our online editor to edit and run the code online.


AngularJs Add Table Row | Append a New Row | Example | Demo

To append/add a new row in a table you don’t need to add the tr, td html tags to add new row. You can do it very easily if you have basic knowledge of AngularJs. You have to just update the object/array used in table. Let us create a simple example to understand this functionality.

AngularJs Add Table Row : Append Table Row Example




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController"> 
<table>
<tr><th>Sample Table</th></tr>
<tr ng-repeat="content in rows">
      <td>{{content}}</td>
</tr>
</table><br/>
 <button ng-click="addNewRow()">Add New Row</button>
</div> 
</div>
  
 

Try it »

Now everything is ready just run the above example to see the demo. If you run the above example it will produce the output something like this –