0

I am new to ionic framework 1. I have been developing an app. But, I can't figure out how do I disapear the keyboard on screen touch. When I fill out any form it seems that some fields are hiding under the keyboard. How do I resolve it? I have tried removing and adding the keyboard plugin. But, it didn't work.

camoflage
  • 147
  • 1
  • 5
  • 11

2 Answers2

0

Just copy/paste following function in your code and call whenever you want to close keyboard.

focusOut() {
    let activeElement = <HTMLElement>document.activeElement;
    activeElement && activeElement.blur && activeElement.blur();
  }
Harish98
  • 445
  • 1
  • 7
  • 16
0

You have mentioned that you are studying ionic framework 1 but Ionic2 is latest so you should go for it. Here is the code to hide the keyboard in Ionic 2:

In Constructor definition,put following

constructor(private keyboard: Keyboard){
}

And where ever you want to close the keyboard, execute following code:

this.keyboard.close();
Rohit Gupta
  • 1,368
  • 1
  • 14
  • 30