primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Autocomplete v19 - Custom selected item with custom remove icon can not be removed

Open ElodieTcy opened this issue 1 year ago • 4 comments

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

ElodieTcy avatar Feb 25 '25 15:02 ElodieTcy

We're also facing the same issue, this is a breaking change

OmkarJ13 avatar Apr 08 '25 06:04 OmkarJ13

I found the same issue, is it possible to fix it asap?

gcannone avatar Apr 16 '25 09:04 gcannone

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: Image v20 docs:

Image

gregorAutomatics avatar Jul 15 '25 08:07 gregorAutomatics

i used removetokenicon with "primeng": "^19.1.4", but the icon didn't replace it add beside the chip

Image

alaa0ezzat avatar Aug 26 '25 14:08 alaa0ezzat