How to hide the keyboard in the cord by pressing "Go" or "Done"

8

I have a form in my app, and I would like that after filling, if the person pressed Ir or Done , the keyboard disappeared.

Has anyone ever gone through this? Or do you know how to solve it?

    
asked by anonymous 30.01.2015 / 13:24

2 answers

2

The best way to interact with the keyboard is by using the ionic-plugin-keyboard plugin.

One of your methods is cordova.plugins.Keyboard.close () that allows you to close the keyboard.

    
23.11.2015 / 01:20
1

I believe that with the idea of @EduardoCalixto work, but need to test, of course. But the logic is this:

  • Attach an event to the control that you want to have this behavior. In the agile it is something like: ng-keydown="expression" , ng-keypress="expression" , ng-keyup="expression" I believe the keypress fits better, with expression being the declared function in its current $ scope to the element in question.
  • In the function attached to the event you control if the clicked key is the button you want through the event.keyCode
  • If the key pressed on the keyboard is what you want then you call the function that @EduardoCalixo mentioned above cordova.plugins.Keyboard.close ()
  • Remembering that you need to have the link plugin installed for the above method to work. Good luck!

        
    16.12.2015 / 11:48