primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.2k stars 4.55k forks source link

Component: Autocomplete #15642

Open urielTwito opened 4 months ago

urielTwito commented 4 months ago

Describe the bug

I am upgrading to angular 16 from angular 12 and now I can not find the method focusInput() were did it go? is there another way to put a focus in the input field programmatically?

note that this api exists in primeng version 16.0.0

Environment

angular 16 prime version 16.9.1

Reproducer

No response

Angular version

16.0.0

PrimeNG version

16.9.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.10.0

Browser(s)

chrome

Steps to reproduce the behavior

the method was there but now it is not. just look at the code

Expected behavior

to be able to set focus on the input control of the autocomplete programatically

Sinan997 commented 4 months ago

Seems, it's removed.

You can find element from DOM and focus manually.

urielTwito commented 3 months ago

what is the best way to do it, which selector should I use to find the input element?, can I inject it with @viewchild or something like this.

Sinan997 commented 3 months ago

You can access the AutoComplete component and use this viewChild property below.

https://github.com/primefaces/primeng/blob/3d5b78ecac68e3b0bb3ef4417c9fc2be3a3fd19d/src/app/components/autocomplete/autocomplete.ts#L688