blob: cf872d922098879e7375ae0ad2c297d39fb3a71e [file] [log] [blame]
Simon Hunt335b2472014-12-08 16:52:18 -08001<!DOCTYPE html>
2<html ng-app="notesApp">
3<head>
4 <title>Notes App</title>
5 <script src="../../tp/angular.js"></script>
6 <style>
7 span {
8 background-color: #cce;
9 }
10 </style>
11</head>
12<body ng-controller="MainCtrl as ctrl">
13
14 <div ng-repeat="note in ctrl.notes">
15 <div>First element: {{$first}}</div>
16 <div>Middle element: {{$middle}}</div>
17 <div>Last element: {{$last}}</div>
18 <div>Index of element: {{$index}}</div>
19 <div>At even position: {{$even}}</div>
20 <div>At odd position: {{$odd}}</div>
21
22 <span class="label"> {{note.label}} </span>
23 <span class="status"> {{note.done}} </span>
24 <br/><br/>
25 </div>
26
27 <script type="text/javascript">
28 angular.module('notesApp', []).controller('MainCtrl', [
29 function () {
30 var self = this;
31 self.notes = [
32 {id: 1, label: 'First note', done: false},
33 {id: 2, label: 'Second note', done: false},
34 {id: 3, label: 'Done note', done: true},
35 {id: 4, label: 'Last note', done: false}
36 ];
37 }
38 ]);
39 </script>
40
41</body>
42</html>