Ionic 4
I want to try to change the cursor position in an input field like this:
HTML
<ion-input #urlInput (ionFocus)="onFocus()" type="text" formControlName="url" autocorrect="off" autocapitalize="none"></ion-input>
COMPONENT
@ViewChild('urlInput', { read: ElementRef }) inputRef;
onFocus(){
const element = this.inputRef.nativeElement as HTMLInputElement;
element.setSelectionRange(0,0);
}
But the console gives the following error: setSelectionRange is not a function
Anyone get any idea how to fix this???