Search code examples
angularngx-chips

ngx-chips, when disable attribute is set to false the tag-input-dropdown displays


When using ngx-chips I have a button that is disabling the input. When the input is enabled the tag-input-dropdown displays as if the user has clicked on the input field.

Here is a working demo of this issue on stackblitz

I have tried using an ngIf on the tag-input-dropdown linked to the disable variable, although this fixes my specific issue it breaks the search functionality.

I have added a bug report to the ngx-chips github page but as it could take a while for this to get looked at, does anyone have any suggestions of a fix for this?


Solution

  • I had a reply on the ngx-chips GitHub page about adding [keepOpen]="false" to my tag-input-dropdown and this fixes the issue with disabling the field.

    <tag-input-dropdown
        [appendToBody]="true"
        [showDropdownIfEmpty]="true"
        [keepOpen]="false"
        [autocompleteItems]="tagItems"
        [identifyBy]="'id'"
        [displayBy]="'title'">
    </tag-input-dropdown>