Second problem -
Are you trying to scroll your container/view on certain event?
Try looking at this solution (I haven’t tested it in iOS yet). You can call that function after required event gets trigerred.
First problem -
If it helps, look at this solution.
Mine implementation -
home.html-
<ion-input #messageInput placeholder="Type your message" name="inputMessage" on-return="sendMessage()"
(ngModelChange)="autoSuggest($event)">
</ion-input>
home.ts-
import { Component, ViewChild, * * } from '@angular/core';
export class HomePage {
@ViewChild("messageInput") public messageInput: ElementRef;
public setInputFocus(){
var elem:any = this.messageInput;
elem._native.nativeElement.focus(); // Keep the focus on input field.
}
The setInputFocus
is the function which focusses on input field. You need to call it from some event or function (may be from SendMessage()
).
You can set blurOnSubmit={false}
to your <ion-input>
if you want to retain keyboard opened after you submit message (using Enter).