-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial6.js
More file actions
37 lines (31 loc) · 722 Bytes
/
tutorial6.js
File metadata and controls
37 lines (31 loc) · 722 Bytes
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
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
.red {
color: red;
}
.green {
color: green;
}
</style>
</head>
<body>
<b> this won't work </b>
<div ng-init="names = ['smith', 'smith']">
<ul>
<ol ng-repeat="name in names"> {{ name }} </ol>
</ul>
</div>
<h2> solution </h2>
<div ng-init="names = [{surname: 'Smith', firstname: 'Joe'}, {surname: 'Smith', firstname: 'Sue'}]">
<ul>
<ol ng-repeat="name in names"> {{name.surname}}, {{name.firstname}} </ol>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
</body>
</html>