forked from shyamseshadri/angularjs-up-and-running
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathng-repeat-helper-variables.html
35 lines (32 loc) · 1.04 KB
/
ng-repeat-helper-variables.html
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
<!-- File: chapter2/ng-repeat-helper-variables.html -->
<html ng-app="notesApp">
<head><title>Notes App</title></head>
<body ng-controller="MainCtrl as ctrl">
<div ng-repeat="note in ctrl.notes">
<div>First Element: {{$first}}</div>
<div>Middle Element: {{$middle}}</div>
<div>Last Element: {{$last}}</div>
<div>Index of Element: {{$index}}</div>
<div>At Even Position: {{$even}}</div>
<div>At Odd Position: {{$odd}}</div>
<span class="label"> {{note.label}}</span>
<span class="status" ng-bind="note.done"></span>
<br/><br/>
</div>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.js">
</script>
<script type="text/javascript">
angular.module('notesApp', [])
.controller('MainCtrl', [function() {
var self = this;
self.notes = [
{id: 1, label: 'First Note', done: false},
{id: 2, label: 'Second Note', done: false},
{id: 3, label: 'Done Note', done: true},
{id: 4, label: 'Last Note', done: false}
];
}]);
</script>
</body>
</html>