File Name: Script.js in Scripts folder.
/// <reference path="angular.min.js" />
var myApp = angular.module("myModule", []);
var myController = function ($scope)
{
var Employee = [
{
FirstName: "Raj",
LastName: "Parihar",
Gender: "Male",
Address: "Pune",
Salary: "Rs. 40000",
Company: "careerRide.com"
},
{
FirstName: "Shiva",
LastName: "Parihar",
Gender: "Male",
Address: "Pune",
Salary: "Rs. 50000",
Company: "Tech.com"
},
{
FirstName: "Mili",
LastName: "Zen",
Gender: "Female",
Address: "US",
Salary: "Rs. 40000",
Company: "IBM"
},
{
FirstName: "Divya",
LastName: "Singh",
Gender: "Female",
Address: "Nagpur",
Salary: "Rs. 40000",
Company: "Infosys"
},
{
FirstName: "Digvijay",
LastName: "Chauhan",
Gender: "Male",
Address: "Pune",
Salary: "Rs. 140000",
Company: "careerRide.com"
}
];
$scope.Emp = Employee;
};
myApp.controller("myCont", myController);
<!DOCTYPE html>
<html ng-app="myModule">
<head>
<script src="Scripts/angular.min.js" type="text/javascript"></script>
<script src="Scripts/Script.js"></script>
<style>
table, th, td
{
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd)
{
background-color: #ffe6e6;
}
table tr:nth-child(even)
{
background-color: #ccffcc;
}
</style>
</head>
<body>
<div ng-controller="myCont">
<table>
<tr>
<th>FirstName</th>
<th>LastName</th>
<th>Gender</th>
<th>Address</th>
<th>Salary</th>
<th>Company</th>
</tr>
<tr ng-repeat="e in Emp">
<td>{{e.FirstName}}</td>
<td>{{e.LastName}}</td>
<td>{{e.Gender}}</td>
<td>{{e.Address}}</td>
<td>{{e.Salary}}</td>
<td>{{e.Company}}</td>
</tr>
</table>
</div>
</body>
</html>
File Name: Script.js in Scripts folder.
/// <reference path="angular.min.js" />
var myApp = angular.module("myModule", []);
var myController = function ($scope)
{
$scope.Countries = [
{
name: "India",
cities:[{name:"Pune"},
{name:"Indore"},
{name:"Banglore"}]
},
{
name: "USA",
cities: [{ name: "New Nork" },
{ name: "Washington" },
{ name: "Los Angeles" }]
},
{
name: "Australia",
cities: [{ name: "Perth" },
{ name: "Sydney" },
{ name: "Melbourne" },
{ name: "Adelaide" }]
},
];
};
myApp.controller("myCont", myController);
<!DOCTYPE html>
<html ng-app="myModule">
<head>
<scrip tsrc="Scripts/angular.min.js" type="text/javascript"></script>
<script src="Scripts/Script.js"></script>
</head>
<body style="font-family:Arial; font-size:medium; color:darkblue">
<div ng-controller="myCont">
<h2>Nesting of ng-repeat directive in AnjularJS</h2>
<ul>
<li ng-repeat="country in Countries">
{{country.name}}
<ul>
<li ng-repeat="city in country.cities">
{{city.name}}
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>