ngx-chips - How to disable tag selection?

1.3k Views Asked by At

I'm using ngx-chips with Angular 5 and cant figure it out how to stop/disable selection of added tags.

I saw in the docs that there is (onSelect) method and try to return false but it is not working. I also try to prevent event with (click), but this method is not available for ngx-chips.

Does anyone know how to stop the tag selection after the tag is added?

1

There are 1 best solutions below

1
On

You can use the readonly property on the tag to achieve what you want. Use the onItemAdded event from ngx-chips, and when the item is added, set the readonly property to true for the new tag.

See the docs regarding this here.

Here is a StackBlitz example.