Autocomplete v19 - Custom selected item with custom remove icon can not be removed
Describe the bug
With PrimeNG v18 multiple autocomplete, I was able to customise my selected item using selectedItem template, and i also had the possibility to customize the remove icon using removetokenicon template.
If I try to do the same with v19, when I click on the custom remove icon, nothing happens, the item is still selected.
As a way to bypass this issue, I tried to customize both the remove icon and the selected item inside the selectedItem template (without using removetokenicon template).
My idea was to call PrimeNG internal method removeOption(event, index) when clicking on the custom icon, unfortunatly I don't have the index value, in some of your templates the index is available (inside autocomplete item template for example), so it could be a quick workaround for my issue, if you just add the index in the selectedItem template.
Pull Request Link
No response
Reason for not contributing a PR
- [x] Lack of time
- [x] Unsure how to implement the fix/feature
- [x] Difficulty understanding the codebase
- [ ] Other
Other Reason
No response
Reproducer
https://stackblitz.com/edit/uox8zzmb-uh3x6z62?file=package.json
Environment
Trying to use PrimeNG 19 autocomplete in multiple mode, with angular 19 and our own custom icons.
Angular version
19.1.5
PrimeNG version
v19
Node version
20.18.3
Browser(s)
No response
Steps to reproduce the behavior
- Go to https://stackblitz.com/edit/uox8zzmb-uh3x6z62?file=package.json
- Enter anything you want in the autocomplete
- Select an item
- Click on the delete icon
- Observe the item is still there
Expected behavior
The item should disappear when clicking on the remove icon
We're also facing the same issue, this is a breaking change
I found the same issue, is it possible to fix it asap?
It seems like this issue still isn't fixed in v19.1.3
Edit: I'm sorry. It is resolved. TemplateContext has remove callback passed to it
It's missing in v19 docs:
v20 docs:
i used removetokenicon with "primeng": "^19.1.4", but the icon didn't replace it add beside the chip