입력 상자가 하나 있습니다. 스캐너에서 작업 할 때 뭔가를 스캔 할 때 자동 입력 번호가 필요합니다. 이제 자동으로 해당 값을 일부 변수에 할당하고 삭제하여 다른 입력을 얻을 수 있습니다. 어떤 아이디어?데이터를 입력 한 후 입력 필드를 재설정합니다
HTML
<ion-view hide-nav-bar="true">
<ion-content class="padding"><br>
<label class="item item-input">
<input type="number" ng-model="code" id="code" name="theInput" auto-focus>
</label>
<div class="tt"><br><br>
Code : <span class="art">{{code}}<br><br></span>
</div><br>
<button ng-click="clear(code)" class="button button-positive">
Clear
</button>
</ion-content>
</ion-view>
JS
.controller('PriCtrl', function($scope) {
window.onload = function() {
document.getElementById("code").focus();
};
$scope.clear= function(code){
$scope.val = code;
document.getElementById("code").value = '';
}
스캐너가 입력 끝에서 "돌아 가기"문자를 보내십니까? 일반적으로 사용합니까? 그렇다면 이것은 form을 submit 할 것이므로,'ng-submit'을 폼에 추가하여'$ scope.code'를 읽고, 그것으로 무언가를 한 다음, 그것을 공백으로 리셋 할 수 있습니다. – Rhumborl