Created
May 23, 2019 02:02
-
-
Save bossbojo/47f12a2b5c6f3eb21002855a066fdaf0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onChangeLang(char) { | |
if (char.key === '*') return; | |
const th_char = 'ๅ/-ภถุึคตจขชๆไำพะัีรนยบลฟหกดเ้่าสวงผปแอิืทมใฝ'; | |
const en_char = '1234567890-=qwertyuiop[]asdfghjkl;\'zxcvbnm,./'; | |
if (th_char.match(char.key)) { | |
this.Barcode = this.Barcode.substring(0, this.Barcode.length - 1); | |
for (let i = 0; i < th_char.length; i++) { | |
if (th_char[i] === char.key) { | |
this.Barcode += en_char[i]; | |
return; | |
} | |
} | |
} | |
} | |
/* | |
<input type="text" class="form-control" id="Barcode" placeholder="รหัสบาร์โค้ด" name="Barcode" | |
[(ngModel)]="Barcode" (keypress)="onChangeLang($event)" (keyup)="onChangeLang($event)"> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice