Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

How can I always have focus on input field?

$
0
0

@gkapatia wrote:

So I have only one input field in my screen and want it to be always focused, so that keypad is up. So this is my approach at the moment.

HTML- Code:

<ion-input #input type="number" (blur)="getFocusBack"></ion-input>

Component Code

@ViewChild('input') myInput ;
ionViewDidLoad() {
     setTimeout(() => {
        this.myInput.setFocus();
     },0);
}
getFocusBack(){
    setTimeout(() => {
        this.myInput.setFocus();
     },0);
}

Is there any good/other way of doing this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>