-
Notifications
You must be signed in to change notification settings - Fork 1
/
hello.html
46 lines (42 loc) · 1.19 KB
/
hello.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
40
41
42
43
44
45
46
<!DOCTYPE HTML>
<html ng-app>
<head>
<title>Hello</title>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter your name">Hello {{yourName}}!!!
</div>
<hr>
<div ng-controller="namesController">
<label>Name:</label>
<input type="text" ng-model="newName" placeholder="Enter your name">Hello {{newName}}!!!
<ul>
<li ng-repeat="name in names">{{ name }}</li>
</ul>
</div>
<hr>
<div ng-controller="addController">
<label>Name:</label>
<input type="text" ng-model="newAddName" placeholder="Enter your name">
<button ng-click="addName()">Add</button>Hello {{newAddName}}!!!
<ul>
<li ng-repeat="name in names">{{ name }}</li>
</ul>
</div>
<hr>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.min.js"></script>
<script type="text/javascript">
function namesController($scope){
$scope.names = ['Rajesh', 'Deepak', 'Navdeep'];
}
function addController($scope){
$scope.names = ['Rajesh', 'Deepak', 'Navdeep'];
$scope.addName = function(){
$scope.names.push($scope.newAddName);
}
}
</script>
</body>
</html>