我正在制作一个包含输入字段和屏幕键盘的页面,使用js实现。我使用了这个键盘:http://jabtunes.com/notation/keyboardcanvasexamples.html
输入字段可以正常接收输入,但问题是与该输入字段相关的Angular筛选器无法工作。我在这个plunker中找到了类似的问题,但没有解决方案:http://plnkr.co/edit/FnrZTAwisYub5Vukaw2l?p=preview HTML:
当使用屏幕键盘打字时,没有任何筛选器响应。但是当使用真实键盘打字时,它们会得到更新并进行相应的数据筛选。为什么会出现这种情况?
感谢您的帮助!
输入字段可以正常接收输入,但问题是与该输入字段相关的Angular筛选器无法工作。我在这个plunker中找到了类似的问题,但没有解决方案:http://plnkr.co/edit/FnrZTAwisYub5Vukaw2l?p=preview HTML:
<html ng-app="plunker">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>
<script src="example.js"></script>
<script src="jKeyboard.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{selected| json}}</pre>
<input type="text" ng-model="selected" id="testInput" typeahead="state.name for state in states | filter:$viewValue | limitTo:8">
</div>
<button id="btn">E</button>
</body>
</html>
js:
angular.module('plunker', ['ui.bootstrap']);
function TypeaheadCtrl($scope) {
$scope.selected = undefined;
$scope.WatchPrintList = function () {
$scope.selected= {};
$scope.$watch('#testInput', function(newVal, oldVal) {
$scope.selected = newVal;
}, true);
}
$scope.states = [
{"name":"Alabama","alpha-2":"AL"},
{"name":"Alaska","alpha-2":"AK"},
//etc etc
];
}
当使用屏幕键盘打字时,没有任何筛选器响应。但是当使用真实键盘打字时,它们会得到更新并进行相应的数据筛选。为什么会出现这种情况?
感谢您的帮助!