Reputation: 73
In the Ionic 3 app, for numeric fields, the numeric keypad is not appearing in iOS devices. For input type number
, the numbers are displaying in the first row of a keypad along with the alphabets. In Android, it's working fine. I tried with angular pattern \d*
and inputmode="numeric"
still its not working.
<input type="number" pattern="[0-9]*" inputmode="numeric">
Upvotes: 5
Views: 6711
Reputation: 31
For those using ionic 4 and higher this is the best solution
<ion-input type="text" inputmode="tel"></input>
The key is the inputmode, that defines the keyboard that is shown. Leaving type=text allows me to allow other keys like "(" or "-" in the phone number field if needed.
See here for details: https://ionicframework.com/blog/keyboard-improvements-for-ionic-apps/
Upvotes: 1
Reputation: 101
I usually use
<ion-input type="tel" pattern="[0-9]*" style="-webkit-text-security:disc"></ion-input>
-webkit-text-security:disc
to cover the input.
Upvotes: 3
Reputation: 2247
Try:
<ion-input type="number" pattern="[0-9]*"></ion-input>
or
<ion-input type="number" pattern="\\d*"></ion-input>
Upvotes: 0