-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathangularJS 解决表单手写输入无法正常选择第一个字母.html
43 lines (40 loc) · 1.42 KB
/
angularJS 解决表单手写输入无法正常选择第一个字母.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
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no" />
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>Document</title>
</head>
<body>
<div style="height: 300px;">
</div>
<form name="formInfo">
<input type="text" class="form-con" use-class="form-con" ng-model="username" name="username" required input-hand-writing>
{{username}}
<!-- {{formInfo.test.$dirty}}
{{formInfo.test.$pristine}}
{{username}} -->
<button ng-disabled="formInfo.$invalid">测试按钮禁用</button>
</form>
<script type="text/javascript" src="http://192.168.1.118/git/h5_v3.0/common/AngularJS/angular.min.js"></script>
<script>
var app = angular.module('app', []);
/**************************
* 解决输入法手写问题
**************************/
app.directive('inputHandWriting',function(){
return {
link : function(scope, elements, attrs, controller){
angular.element(elements).bind('click input', function(event) {
angular.element(this).attr('class', '').addClass(attrs.useClass);
});
}
};
});
</script>
</body>
</html>