How to Hide Keyboard in Ionic 3?

2019-07-31 04:24发布

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条回答
Melony?
2楼-- · 2019-07-31 04:58

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()
查看更多
登录 后发表回答