How to prevent the keyboard appearance


#1

I have a simple form.
One field is a date picker directive from http://plnkr.co/edit/AbvLyzWOz3iIV8GCqJQ4.
How to prevent the keyboard appearance.
The datepicker appears with the keyboard and i must tap somewhere cause hide keyboard.
This is a screenshot from emulator.

Itried to use keyboard plugin in failure. maybe i dont know to use this plugin.
Thanks Dimitris


#2

I don’t know if this is the correct way to do it, but I added a div that is styled like an input box to avoid the keyboard opening. It looks like this (I have some custom styling in mine):

<div ng-click="showDatePickerModal()" class="item item-input item-icon-right item-separator">
    <span class="input-label">Date</span>
    <span ng-if="date">{{date | date : 'EEEE, MMM d, y'}}</span>
</div>

So in your case you could call opendateModal() in the ng-click of the entire div or just the span where you show the date. I like this way because I can display the date how I want to.

Which keyboard plugin did you use? Have you tried using ionic-plugins-keyboard: cordova.plugins.Keyboard.close()?


#3

brandyshea Thank you very much for your help.
Your way is very clever. I did what exactly you have proposed and it works perfect. i tried to use cordova.plugins.Keyboard.close() but with no result…


#4

Thanks! I did what I could to make it work. :stuck_out_tongue: I’m glad I could help. I never even thought of trying to close the keyboard, haha.