Reputation: 177
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.
Upvotes: 0
Views: 504
Reputation: 1378
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();
Upvotes: 0
Reputation: 485
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();
}
Upvotes: 0