Saturday, June 9, 2018

Show / hide keyboard in ionic 2 | ionic 3 in ionic 2 | ionic 3 | ionic 4

This is very easy by using keyboard plugin. Please use below code in your TS file.


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

@Component({

  selector: ‘page-name’,

  templateUrl: ‘page.html’,

  providers: [Keyboard]

})

constructor(private keyboard: Keyboard) {  

  /* Show keyboard */

  this.keyboard.show();


  /* Hide keyboard */

   this.keyboard.close();

 }


Note : This is only supported by Android. For iOS we can not open keyboard by this function. (Open keyboard method is not works in iOS)



No comments:

Post a Comment