Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
902 stars 359 forks source link

When disable is set to false the tag-input-dropdown displays #872

Closed Simon245 closed 5 years ago

Simon245 commented 5 years ago

PLEASE MAKE SURE THAT:

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] support request/question

Notice: feature requests will be ignored, submit a PR if you'd like

Current behavior I am using a button to disable the chips input. When I enable the input with the button the autocomplete dropdown displays.

Expected behavior For the autocomplete dropdown to only display when clicking on the input.

Minimal reproduction of the problem with instructions (if applicable) https://stackblitz.com/edit/angular-ngx-chip-dropdown-test

Click on the button to enable/disable the tags

What do you use to build your app?. Please specify the version Angular CLI 6.1.5

Angular version: 6.1.0 on my project and 7.2.5 on stackblitz example

ngx-chips version: 1.9.8

Browser: [ Chrome Version 73.0.3683.103 ]

sarahtully commented 5 years ago

@Simon245 I think you can get the desired behavior by adding [keepOpen]="false"

So your code would look like:

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

@sarahtully Thank you so much, that works. I don't know why I didn't try that one, I guess I was happy with it opening again after adding a tag.

Gbuomprisco commented 5 years ago

Thanks @sarahtully