-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.html
More file actions
51 lines (42 loc) · 1.23 KB
/
t1.html
File metadata and controls
51 lines (42 loc) · 1.23 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1 ng-click="changeName()">{{firstname}}</h1>
<input type="button" ng-click="clickme()" ng-mouseover="mover()" ng-mouseleave="mleave()" value="{{txta}}">
<select ng-change="change_select(selected)" ng-model="selected">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstname = "John";
$scope.changeName = function() {
$scope.firstname = "Nelly";
}
$scope.txta='hahahaha';
$scope.clickme = function() {
alert('xin chao');
}
$scope.mover=function(){
$scope.txta='hohohoho';
}
$scope.mleave=function(){
$scope.txta='hahahaha';
}
//Selectbox
$scope.selected='audi';
$scope.change_select=function(selected){
alert(selected);
}
});
</script>
<p>Click on the header to run the "changeName" function.</p>
<p>This example demonstrates how to use the controller to change model data.</p>
</body>
</html>