-
Notifications
You must be signed in to change notification settings - Fork 317
Expand file tree
/
Copy pathindex.html
More file actions
66 lines (61 loc) · 2.2 KB
/
index.html
File metadata and controls
66 lines (61 loc) · 2.2 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html ng-app="customControl">
<head>
<title>ngModelController</title>
<meta charset="utf-8">
<script src="../angular-1.3.2.js"></script>
<script src="script.js"></script>
<link type="text/css" href="../bootstrap.css" rel="stylesheet" />
<style>
*{font-family: 'MICROSOFT YAHEI'}
</style>
</head>
<body>
<div class="container" ng-controller="ctrl">
<div class="page-header">
<h1>ngModelController- <small>创建一个实现了双向数据绑定的可编辑文本区域</small></h1>
</div>
<form role="form" name="myForm">
<div class="form-group">
<div contenteditable name="myWidget" ng-model="userContent" ng-model-options="{debounce:1000}" class="form-control" required default-text="请输入内容"></div>
</div>
<div class="form-group">
<button type="button" class="btn btn-default btn-primary" ng-click="setNone()">设置为'抱歉,我没有想输入的内容'</button>
</div>
<div class="alert alert-danger" role="alert" ng-show="myForm.myWidget.$error.required">
<strong>Oh!</strong> 必填!
</div>
</form>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">用户输入的内容为:</h3>
</div>
<div class="panel-body">
{{userContent}}
</div>
</div>
</div>
<div class="container" ng-controller="Rollback">
<form role="form" name="myForm2" ng-model-options="{ updateOn: 'blur' }">
<div class="form-group">
<label>执行了 $rollbackViewValue() 方法</label>
<input name="myInput1" ng-model="myValue1" class="form-control" ng-keydown="resetWithRollback($event)">
<blockquote>
<footer>myValue1: "{{ myValue1 }}"</footer>
</blockquote>
<p></p>
</div>
<div class="form-group">
<label>没有执行了 $rollbackViewValue() 方法</label>
<input name="myInput2" ng-model="myValue2" class="form-control" ng-keydown="resetWithoutRollback($event)">
<blockquote>
<footer>myValue2: "{{ myValue2 }}"</footer>
</blockquote>
</div>
</form>
</div>
<div class="container">
<a href="http://plnkr.co/edit/CbOS1nFosPDfQXvsGTyR?p=preview" class="btn btn-default" role="button">在线预览</a>
</div>
</body>
</html>