Angularjs table tutorial

AngularJS table:

Orderly arrangement of quantitative data in columns and rows is known as table. In AngularJS ng-repeat directive is used for displaying tables. Let us have a brief look at ng-repeat directive.

ng-repeat directive:

The ng-repeat directive is used to repeats html elements for each item in a collection.


<div ng-app = "">
   <p>List of students with country name:</p>
      <li ng-repeat = "student in students">
         {{ Name: ' + + ', Country: ' + }}

Example explanation:

The ng-app directive initializes the application. We create a students object which is initialized by ng-init directive using JSON syntax. The ng-repeat directive will work as for-each loop and iterates over students object.


    <title>AngularJS Table Example</title>    
    <script src=
     table, th , td {
      border: 1px solid grey;
      border-collapse: collapse;
      padding: 5px;
     table tr:nth-child(odd) {
      background-color: #f2f2f2;
     table tr:nth-child(even) {
      background-color: #ffffff;
      <h1>AngularJS Table Example.</h1>
      <div ng-app = "" 
           ng-init = "students=[{name:'Prabhjot',country:'US'},
         <p>Students with country name:</p>
              <tr ng-repeat = "student in students">
                 <td>{{ }}</td>
                 <td>{{ }}</td>

Try it:

AngularJS Table Example on

Comments are closed.