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

当nzSelect组件绑定的值为数组时,默认值没有被选中 #4139

Closed
JohnGao818 opened this issue Sep 11, 2019 · 1 comment · Fixed by #4140
Closed

当nzSelect组件绑定的值为数组时,默认值没有被选中 #4139

JohnGao818 opened this issue Sep 11, 2019 · 1 comment · Fixed by #4140

Comments

@JohnGao818
Copy link

Reproduction link

https://stackblitz.com/edit/angular-73fp31?embed=1&file=src/app/app.component.ts

Steps to reproduce

nzSelect的option的nzValue的值为数组,ngModel绑定的值也为数组,自定义compareWith函数,当数组中的第一个值相等时,使对应的option被选中。但实际默认选项确未被选中。但当我把绑定的值改为对象时,却可以正常选中,数组就不行

What is expected?

当nzSelect组件绑定的值为数组时,符合compareWith函数的选项被默认选中

What is actually happening?

符合compareWith函数的选项未被选中

Environment Info
ng-zorro-antd 8.3.0
Browser chrome
@zorro-bot
Copy link

zorro-bot bot commented Sep 11, 2019

Translation of this issue:

When the value bound to the nzSelect component is an array, the default value is not selected.

Reproduction link

[https://stackblitz.com/edit/angular-73fp31?embed=1&file=src/app/app.component.ts](https://stackblitz.com/edit/angular-73fp31?embed=1&file=src/ App/app.component.ts)

Steps to reproduce

The value of nzValue of nzSelect's option is an array, and the value of ngModel binding is also an array. Custom compareWith function, when the first value in the array is equal, the corresponding option is selected. However, the actual default options are not selected. But when I change the value of the binding to an object, it can be selected normally, and the array will not work.

What is expected?

When the value bound to the nzSelect component is an array, the option that conforms to the compareWith function is selected by default.

What is actually happening?

The option to match the compareWith function is not selected

Environment Info
ng-zorro-antd 8.3.0
Browser chrome

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.

2 participants