-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangularPrac.html
69 lines (65 loc) · 2.17 KB
/
angularPrac.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
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
.bg-green{
background: green;
}
.bg-gray{
background: #ededed;
}
</style>
</head>
<body ng-app="myapp" ng-controller="myController" class="bg-{{color}}">
<div class="container">
<form name="myform">
<div class="row">
<div class="col-sm-2">
邮箱:
</div>
<div class="col-sm-10">
<input type="email" name="email" ng-model="email" placeholder="please enter your email" required>
</div>
</div>
<div class="row">
<div class="col-sm-2">
密码:
</div>
<div class="col-sm-10">
<input type="password" name="password" ng-model="password" placeholder="please enter your password" required>
</div>
</div>
<div class="row">
<div class="col-sm-offset-2">
<button ng-disabled="myform.email.$invalid || myform.password.$error.required" ng-click="reset()">Submit</button>
<button ng-show="myform.email.$invalid || myform.password.$error.required" ng-click="back()">back</button>
</div>
</div>
</form>
</div>
<script>
angular.module("myapp",[]).controller("myController",function($scope){
$scope.email = "jsbintest@test.com";
$scope.password = "12345678";
$scope.color = "green";
$scope.reset = function(){
$scope.email = "";
$scope.password = "";
$scope.color = "gray";
};
$scope.back = function(){
$scope.email = "jsbintest@test.com";
$scope.password = "12345678";
$scope.color = "green";
};
});
</script>
</body>
</html>