/
nested_ng-repeat.php
49 lines (49 loc) · 1.48 KB
/
nested_ng-repeat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Angular JS</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body ng-app="appModule">
<div ng-controller="appController">
<ul ng-repeat="country in countries">
<li>{{ country.name }}
<ul ng-repeat="city in country.cities">
<li>{{city.name}}</li>
</ul>
</li>
</ul>
</div>
<script src="//code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script>
angular.module('appModule', [])
.controller('appController', ['$scope', function($scope){
$scope.countries = [
{name:'USA', cities: [
{name:'Newyork'},
{name:'Washington'},
{name:'Texas'}
]},
{name:'India', cities: [
{name:'Delhi'},
{name:'Mumbai'},
{name:'Banglore'}
]},
{name:'Germany', cities: [
{name:'Bayren'},
{name:'Regensberg'},
{name:'Frankfurt'}
]}
]
}]);
</script>
</body>
</html>