iOS/Android:在密码类型输入字段上打开数字键盘

tom*_*hup 3 passwords keyboard input numeric angularjs

在我的Angular/Ionic应用程序中,有一个PIN码安全性,用户需要在三个不同的输入字段中输入3位数字.

我使用"密码"类型的输入,但是当用户点击这些输入时,我想显示一个电话型键盘(只有10位数字).

使用<input type="tel">并不好,因为我希望输入隐藏数字,如密码类型输入.

有关如何做到这一点的任何想法?此外,这需要适用于Android/iOS平台.

干杯,

番茄酱

小智 5

使用css你可以做到这一点

将此类添加到您的CSS.

.mask-text {
    -webkit-text-security: disc;
    -moz-webkit-text-security: disc;
    -moz-text-security: disc;
}
Run Code Online (Sandbox Code Playgroud)

并在你的输入元素中使用它,它将在IOS 6 +和android 4.0 +设备中工作.它不适用于Windows设备.

<input class="form-control mask-text" type="tel"
    name="account"  ng-    model="my.model" >'
Run Code Online (Sandbox Code Playgroud)