Ionic framework customize native keyboard

2019-09-18 11:53发布

问题:

Is it possible to show and customize the native keyboard with Ionic framework? Lets say for example that I want to show the native keyboard when you come to a state and I want the keyboard to only contain specific characters (only letter for example).

回答1:

You can do this with the keyboard plugin. Checkout this plugin

http://ngcordova.com/docs/plugins/keyboard/



回答2:

Input Type Method

Although you cannot change the makeup of the keyboard, you can use different type parameters on your input elements to control which type of keyboard mobile devices will show.

For an overview of the different types of inputs, check out this site.

Return False Method

In addition to changing the type of keyboard that displays, you can also specifically allow or disable certain characters. Accomplish this by checking each keycode as it is typed. For a reference of keycodes, see here.

<input type="text" onkeypress="if(event.keyCode == 101){ return false; }">