-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontrollersExample.html
41 lines (35 loc) · 1.05 KB
/
controllersExample.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
36
37
38
39
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Sample Angular JS application - controllers example</title>
<script src="angular.min.js" type="text/javascript">
</script>
<script>
// Note: From Angular 1.3+ , we need to register the controllers
// using the below syntax
angular.module('app',[]).controller('SimpleController',['$scope',
function SimpleController($scope) {
$scope.customers = [
{name: 'Akshay Kumar' , city: 'Chandigarh'},
{name: 'Madhuri Dixit' , city: 'Mumbai'},
{name: 'Shah Rukh Khan' , city: 'Delhi'},
{name: 'Anil Kumble' , city: 'Bangalore'},
{name: 'Rishi Kanitkar' , city: 'Pune'},
{name: 'Dhanraj Pillai' , city: 'Pune'}
];
}]);
</script>
</head>
<body>
<!-- We can have controllers for different section of the page -->
<div ng-controller="SimpleController">
<h3>Enter a name to filter</h3>
<input type="text" ng-model="nameText">
<ul>
<li ng-repeat="cust in customers | filter: nameText | orderBy:'name'">
{{ cust.name }} - {{ cust.city }}
</li>
</ul>
</div>
</body>
</html>