Keep Keyboard Open On Ionic When Button Click ( Chat App )
I have an Ionic v1 chat application, I made everything, but I encountred the famous problem when clicking on a send button (send chat) the keyboard loses focus from the input and
Solution 1:
ALright found a fix! for all of you out there, who are using ionic for a chat like app, and want the keyboard to stay focused after clicking on a button,
Just, replace the button by a label with for="inputID" like so:
<div class="sender">
<input id="inputID" type="text" ng-model="..." class="...">
<div class="button-send">
<label for="inputID" class="send-chat"><i class="ion ion-send"></i></label>
</div>
</div>
Solution 2:
just use (mousedown)="sentMessage(); $event.preventDefault()"
<ion-button (mousedown)="sentMessage(); $event.preventDefault()">
<ion-icon ios="ios-send" md="md-send"></ion-icon>
</ion-button>
Solution 3:
Try forcing the keyboard to open via it's cordova plugin https://github.com/ionic-team/ionic-plugin-keyboard#keyboardshow
Post a Comment for "Keep Keyboard Open On Ionic When Button Click ( Chat App )"