How to hide ionic keyboard in Auto focus

1.6k Views Asked by At

I am using Ionic 3 and Angular 5. I have a text-area with Auto focus. problem is, I do not want to show keyboard in auto focus. How can I hide keyboard in Auto focus. Here is my code.

 setTimeout(() => {
  this.myInput.setFocus();
},1000);

This code is for Auto focus.

<ion-textarea style="color:red; opacity: 0;" #input id="myInput" rows="1" maxLength="500"  [(ngModel)]="details" (ionChange)="Scan($event)" ></ion-textarea>

This is HTML code please help me out. Thanks

1

There are 1 best solutions below

3
Paresh Gami On

You can use this code for hiding keyboard

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

constructor(private keyboard: Keyboard) { }

...

this.keyboard.show();

this.keyboard.close();