How to exit focused input?

I have simple input which looks like this:

<ion-input [(ngModel)]="testData.start" name="start" type="text" placeholder="Enter test start date" required="required" readonly="readonly" (focus)="showDateTimePicker($event)"></ion-input>

The problem that when showDateTimePicker is done I need to exit input so I call which triggers focus event for second time. So basically when showDateTimePickeris called two times.

Is it possible somehow solve it?

you could try to call $event.preventDefault(); to avoid the default focus bevahior

Where exactly should I put it? The problem is that I need that focus event would be fired, but in fires twice. On focus and on blur.

yeah but you only want to listen on focus to call your custom function. if you run preventDefault at the beginning of your function the default behavior of focussing that input does not happen, but your logic is executed.

Nope. It still enters the input… I need that is not be possible to enter/edit input.

then try:



For now I just added readonly but still I wondering why $ triggers focus event…