AngularJS-7 : ng-repeat
angular.min.js
-------------------------------------
Script.js
------------------------------------/// <reference path="angular.min.js" />
var myAppModule = angular.module("myAppModule",[]).controller("myDataController",function ($scope) {
var employees =
[
{
firstName : "pavan",
lastName : "kumar",
gender : "Male"
},
{
firstName : "ram",
lastName : "kumar",
gender : "Male"
}
]
$scope.employees = employees;
});
myHTML.html
---------------------------------------
<!DOCTYPE html>
<html ng-app="myAppModule">
<head>
<script type="text/javascript" src="resources/js/angular.min.js"></script>
<script type="text/javascript" src="resources/js/Script.js"></script>
</head>
<body ng-controller="myDataController">
<table>
<thead>
<tr>
<th>First Name </th>
<th>Last Name</th>
<th>Gender</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="emp in employees">
<td>{{emp.firstName}}</td>
<td>{{emp.lastName}}</td>
<td>{{emp.gender}}</td>
</tr>
</tbody>
</table>
</body>
</html>
No comments:
Post a Comment