ngx-ui icon indicating copy to clipboard operation
ngx-ui copied to clipboard

ngx-select doesn't react to zero option templates

Open swimlane-alex opened this issue 2 years ago • 1 comments

ngx-select suports passing options via two methods:

  1. As an input:
<ngx-select [options]="myOptions"></ngx-select>
  1. 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.

swimlane-alex avatar Dec 12 '22 17:12 swimlane-alex

@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

ruahung20011 avatar Mar 22 '23 03:03 ruahung20011