How to Hide Keyboard in Ionic 3?

2019-07-31 04:15发布

问题:

How to Hide Keyboard in ionic3?

We have a problem with ionic 3 apps during testing in iPhone. After fillup Payment Gateway information (which is launched in iFrame), Whenever we go to the back page using the back button, Keyboard is not Hiding.

We used cordova-plugin-ionic-keyboard and use Keyboard.hide() method. But didn't work.

回答1:

Try this

import { Keyboard } from '@ionic-native/keyboard';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
 constructor(public navCtrl: NavController, public keyboard : Keyboard) {
  }
}

and then on back button use this

this.keyboard.close()