Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
swimlane-alex opened this issue Dec 12, 2022 · 1 comment
Open

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

swimlane-alex opened this issue Dec 12, 2022 · 1 comment

Comments

@swimlane-alex
Copy link
Contributor

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 swimlane-alex changed the title ngx-select doesn't react to zero empty option templates ngx-select doesn't react to zero option templates Dec 12, 2022
@ruahung20011
Copy link

@swimlane-alex Hey! I think i fixed the problem. So i created a pull request: #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants