primeNG p-autocomplete autofocus
Hello i'm using p-autocomplete element tag ,which is not inside of p-dialog box,
i'm trying to implement autofocus to a particular area or element upon opening a model window i have tried with different ways of implementation but nothing gets solve my issue.
From my investigation, when the onAutoShow() function triggers just (this.resourceSignum) gets undefined
Below is my code of html and component. .html file
<p-autoComplete #name (onShow)= "onAfterShow()">
component.ts file
import { AutoComplete } from 'primeng/autocomplete';
@ViewChild('name') private name: AutoComplete;
onAfterShow() { this.name.focusInput(); }
Autocomplete doesn't have an (onShow) event, only dialog does.
Hey JacobSiegle Thanks for your comment
Actually i tried with (onFocus) to trigger an event but its not happening, so i tried with (onShow) but its useless any suggestion
You need to wait for the viewchild element in the primeng component to load. Here's a really quick example - https://stackblitz.com/edit/github-1n5qef?file=src/app/app.component.ts. You can probably find more elegant solutions by searching for this common problem.
Thank you and i will try to implement in your way..!
hey tired but i'm getting error please find the belo
w screenshot
There's something in your code not being shown in the issue to get that error. I don't believe this is an issue but a help request. You can try to post to the primeng forums for help requests https://forum.primefaces.org/.
It seems like your code is using https://ng-bootstrap.github.io/#/components/modal/examples. You need to sync running your code when the dialog appropriately shows most likely. I don't use ng-bootstrap so I cannot assist you and this is not an issue with PrimeNG so it shouldn't be posted here.
yes i'm using ng-bootstrap for the model windows
Please use forum for discussions.