AngularJS tables

Sample Code:

<!DOCTYPE html>
<html>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<div ng-app="" ng-init="persons = [{firstname:'Test', lastname:'Sample'}, {firstname:'Test1', lastname:'Sample1'}, {firstname:'Test2', lastname:'Sample2'}, {firstname:'Test3', lastname:'Sample3'}, {firstname:'Test4', lastname:'Sample4'}, {firstname:'Test5', lastname:'Sample5'}]"> 
<table border = "1" cellspacing = "5" cellpadding = "5">
<tr ng-repeat="x in persons">
<td>{{ x.firstname }}</td>
<td>{{ x.lastname }}</td>
</tr>
</table>
</div>
</body>
</html>

Output:


Cheers!!!

No comments:

Post a Comment