Input in android


#1

Hello I created code for have automatically this pattern in input : ODCWY-ZI0ZD-C3NTI
All alright in all platform but Android don’t have good comportment .

Myfile.html :

<ion-input
maxlength=“17”
(input)="runTimeChange($even)"
autocapitalize="characters"
autofocus
>

Myfile.ts:

runTimeChange(ev) {
    let data = ev.data;
    ev.target.value = ev.target.value.toUpperCase();

    if (giftCard.value.length === 5 || giftCard.value.length === 11) {
        ev.target.value = `${ev.target.value}-`;
    } 
    ev.target.setSelectionRange(giftCard.value.length + 1, giftCard.value.length  + 1);
}

Always in Android, this code add - but don’t auto place cursor in last caracter, i need help :smiley:

image