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

Select field is empty if there are some pre-selected Items in the component #4000

Closed
shohrukh92 opened this issue Aug 13, 2019 · 6 comments · Fixed by #4261
Closed

Select field is empty if there are some pre-selected Items in the component #4000

shohrukh92 opened this issue Aug 13, 2019 · 6 comments · Fixed by #4261
Assignees

Comments

@shohrukh92
Copy link

Reproduction link

https://stackblitz.com/edit/angular-fxhfwu?file=src/app/app.component.ts

Steps to reproduce

  1. Run the demo app from docs: "Hide already selected options in the dropdown"
  2. Initialize selected items array with some values: listOfSelectedValue: string[] = ['Apples', 'Bananas'];

What is expected?

Pre-selected Items should be displayed as tags in the Select field (i.e. 'Apples', 'Bananas').

What is actually happening?

The Select field is empty if there is pre-selected Items in the component.
This might be the case if we are using "nz-select" as a form field and we want to patch form with some previously saved data during Form initialization.

Environment Info
ng-zorro-antd 8.2.0
Browser Any browser
@littleinsz
Copy link

Same question.
I have a nz-select in a nz-dropdownMenu.When close dropdown and reopen it.Pre-selected Items are missing.

@vthinkxie
Copy link
Member

Same question.
I have a nz-select in a nz-dropdownMenu.When close dropdown and reopen it.Pre-selected Items are missing.

plz check #1455
it is the bug of angular

@vthinkxie
Copy link
Member

@shohrukh92 plz check this #4000 (comment)

@shohrukh92
Copy link
Author

@vthinkxie I've checked but it seems like #4000 is related to something different. From what I understand the tags in the Select field is generated based on items in the dropdown list itself. So when we want to hide selected items in the list, this issue is happen.

@vthinkxie
Copy link
Member

vthinkxie commented Aug 14, 2019

@shohrukh92 it should be #1455, sorry for misleading

@vthinkxie
Copy link
Member

Hi @shohrukh92
we will provide nzHide in next version, use it instead of *ngIf, everything will work fine

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

Successfully merging a pull request may close this issue.

4 participants