Ion-input select all text on focus

@karvanj I had to go into an other direction but not because of this problem. I haven’t tried but I think something like this should work (ViewChild):

@ViewChild('qtyInput') qtyInput;
this.qtyInput.nativeElement.select();

Alternatively you can reach all native elements on the page with ElementRef:

constructor(private projectUsersEl:ElementRef)
let el = this.projectUsersEl.nativeElement.querySelector('ng-select#usersSelectionControl');
el.children[0].click();

The methods above are not recommended!

1 Like