-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10-controllerWithAs.html
More file actions
35 lines (34 loc) · 1.1 KB
/
10-controllerWithAs.html
File metadata and controls
35 lines (34 loc) · 1.1 KB
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
<!doctype html>
<html ng-app>
<head>
<title>
Controllers With As
</title>
<link href="styles/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div ng-controller="CustomersController as ctrl">
<h2>Customers</h2>
FilterL <input type="text" ng-model="customerFilter.name">
<br><br>
<table>
<tr>
<td ng-click="doSort('name')">Name</td>
<td ng-click="doSort('city')">City</td>
<td ng-click="doSort('orderTotal')">Order Total</td>
<td ng-click="doSort('joined')">Joined</td>
</tr>
<tr ng-repeat="cust in ctrl.customers | filter:customerFilter | orderBy:sortBy:reverse"><!-- limitTo:2 -->
<td>{{ cust.name | uppercase }}</td>
<td>{{ cust.city | lowercase }}</td>
<td>{{ cust.orderTotal | currency }}</td>
<td>{{ cust.joined | date }}</td> <!-- date: 'yyyy-MM-dd' 'medium' 'longDate' -->
</tr>
</table>
<br>
<span>Total customers: {{ ctrl.customers.length }}</span>
</div>
<script src="scripts/angular.js" type="text/javascript"></script>
<script src="app/controllers/customersControllerWithAs.js"></script>
</body>
</html>