-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
74 lines (72 loc) · 2.26 KB
/
index.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html ng-app="myApp">
<head>
</head>
<body>
Hello World
<div ng-controller="myCtrl">
{{ name }} <!--equivalent to <span ng-bind="name"></span>-->
<button ng-click="setToAnand()">Click me</button>
<button ng-click="deleteElement()">do not click me</button>
<input type="text" ng-model="search" ng-change="inputChanged()"/>
search model : {{ search }}
<ul>
<li ng-repeat="item in list | filter:search">
{{item.name}} - {{item.gender}}
<button ng-click="setFem(item, $index)"></button>
</li>
</ul>
</div>
<script src="angular.min.js"></script>
<script>
angular.module("myApp", [])
.controller("myCtrl", function($scope, $log){
$scope.search = "type smthing";
$scope.setFem = function(item, idx){
item.gender = "f";
$scope.list[idx].name = "ttrwtr";
};
$scope.setToAnand = function(){
$scope.name = "anand";
$scope.search= " I am coming from the server";
};
$scope.inputChanged = function(){
$log.log("input changed to " + $scope.search);
$scope.name="jerome";
};
$scope.deleteElement = function(){
$scope.list.splice(0,1);
};
$scope.name = "enkhtur";
$scope.list = [{
name: "enhtur",
gender: "m"
},{
name: "lulu",
gender: "m"
},{
name: "anand",
gender: "m"
},{
name: "jerome",
gender: "m"
},{
name: "enhtur",
gender: "m"
},{
name: "jerome",
gender: "m"
},{
name: "enkhtur",
gender: "m"
},{
name: "jerome",
gender: "m"
},{
name: "enhur",
gender: "m"
}];
});
</script>
</body>
</html>