Welcome to JS Bin
Load cached copy from
 
<html>   
   <head>
    <title>AngularJS Table Sorting Example</title>    
    <script src=
     "http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
    </script>
    <style>
     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;
     }
    </style>
   </head>
   <body>
      <h1>AngularJS Table Sorting Example.</h1>
      
      <div ng-app = "" 
           ng-init = "students=[{name:'Prabhjot',country:'US'},
                                {name:'Nidhi',country:'Sweden'},
                                {name:'Kapil',country:'India'}]"
                                > 
         <p>Students with country name:</p>
         <table>
              <tr>
                   <th>Name</th>
                   <th>Country</th>
              </tr>
                     
              <tr ng-repeat = "student in students | orderBy : 'name'">
                 <td>{{ student.name }}</td>
                 <td>{{ student.country }}</td>
              </tr>                         
         </table>
      </div>      
   </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x