swimlane / ngx-ui

🚀 Style and Component Library for Angular
https://swimlane.github.io/ngx-ui/
MIT License
706 stars 112 forks source link

ngx-select doesn't react to zero option templates #945

Open swimlane-alex opened 1 year ago

swimlane-alex commented 1 year ago

ngx-select suports passing options via two methods:

  1. As an input:
    <ngx-select [options]="myOptions"></ngx-select>
  2. As templates:
    <ngx-select>
    <ngx-select-option *ngFor ="let option of myOptions" [name]="option.name" [value]="option.value"></ngx-select-option>
    </ngx-select>

When using the template method, if at least one option is rendered, followed by rendering zero options, ngx-select's internal options won't be updated because cases without any templates are ignored. This causes the component to continue displaying the previous list of options.

The code linked was probably written to ensure that when passing options as an input, the lack of option templates is ignored.

ruahung20011 commented 1 year ago

@swimlane-alex Hey! I think i fixed the problem. So i created a pull request: https://github.com/swimlane/ngx-ui/pull/970. Can you check it? Feel free to ask me about the code =))

And i noticed, that when the [tagging]="true" && [options]="[]", the dropdown is not shown. Is that the right behavior?

Screenshot 2023-03-22 at 04 14 30