Reputation: 186
I'm using for my ionic app. Everything working fine. When I choose calendar for Date field its displaying keyboard in mobile app.
I want to disable that keyboard when click on calendar input field.
I tried this...
<p-calendar showTime="showTime" id="someThing" placeholder="Start Date & Time" hourFormat="24" [minDate]="minDate"
[defaultDate]="minDate" (click)="onPickDate()" formControlName="pick_up_datetime" [touchUI]="true" [showIcon]="true" (ionFocus)="keyboard_show()">
and ts file like below
import {Keyboard} from '@ionic-native/keyboard';
constructor(private keyboard: Keyboard) {
}
keyboard_show(){
this.keyboard.hide();
}
but its not working.
Upvotes: 0
Views: 425
Reputation: 186
After some research, I found working solution,
In <p-calendar></p-calendar>
there is a default directive called [readonlyInput]="true"
, add this into p-calendar like this..
<p-calendar [showTime]="true" formControlName="pick_up_datetime" [touchUI]="true" [showIcon]="true" [readonlyInput]="true"></p-calendar>
It will work.
Upvotes: 4