I have this function in a controller “ScanCtrl”
$scope.keyup = function(event) {
if (event.keyCode == 90) {
$scope.do_scan();
}
//failsafe for invalid scans
if ($scope.scan_value.length >= 20) {
$scope.do_scan();
}
}
it’s attached to a directive:
app.directive('scan', function() {
return {
restrict: 'AE',
replace: 'true',
template: '<input id="spt_scan_input" styleX="position: absolute; left: -400px" type="text" ng-keyup="keyup($event)" ng-model="scan_value"/>',
/*
link: function(scope, elem, attrs) {
elem.bind('blur', function() {
scope.do_scan();
});
}
*/
}
})
and the directive is attached here:
<div ng-repeat="item in scan_queue">
<a ng-click="go('scan');" class="item item-icon">
<i class="icon ion-{{item.icon}}"></i>
<div style="float: right">>></div>
<b>{{item.value}}</b>
</a>
</div>
For some reason, the function refuses to work on an iPad mini native or simulated. I’ve tried using keypressed and keydown, and neither work.
What’s baffling is that the function works perfectly across all Android devices, and the iPhone 6 simulator seems to be able to detect at least when the input field has a length of 20. Has anyone else run into this issue or would anyone know a fix?