question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NZ Select doesn't select the option that has nzValue=undefined and the ngModel value is also `undefined`

See original GitHub issue

Reproduction link

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

Steps to reproduce

Create a nz-select with an option that has the [nzValue]=undefined. Set the [(ngModel)] for the nz-select to a variable that has the value undefined

What is expected?

It is expected the nz-select to select the option with the [nzValue]=undefined

What is actually happening?

No options are selected

Environment Info
ng-zorro-antd 10.0.2
Browser *

As a side node, the HMTL select element works as expected

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
Alegitercommented, Jan 18, 2021

What about “null” as nzValue? It should be considered as value

In @IonelLupu repro “null” behaves like “undefined”

@vthinkxie here is a repro link You can see the option selected by angular, which is the “All” option and the option selected by zorro, which is none. Both are using the same ngModel

I can drop nz-select value to “null” with nzAllowClear, but nz-option with nzValue=null don`t map

I really need this feature)

1reaction
sorahncommented, Oct 21, 2020

@vthinkxie we’ve had this problem too with using null as the value, and wanting to “reset” the select back to having a null value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select | NG-ZORRO - Ant Design
Angular Select Component, Select component to select value from options.A dropdown menu for displaying choices - an elegant alternative to the native.
Read more >
Angular ngZorro: [(ngModel)] does not pre set <select> tag value
I can display the whole list of reasonList, select a value and get the id, so far so good. Now, when I want...
Read more >
ng-zorro/ng-zorro-antd - Gitter
Hey everyone, I am using antd 8.x.x in angular 8, Here facing issue regarding nzPlaceHolder attribute of nz-select. nzPlaceHolder default color is grey...
Read more >
Select - Ant Design
Property Description Type Default allowClear Show clear button. boolean false autoFocus Get focus by default boolean false defaultActiveFirstOption Whether active first option by default boolean true...
Read more >
How to use Basic ComboBox (Select Option) using NgModel
Angular - How to use Basic ComboBox ( Select Option ) using ngModelif ... new or my video helps with your project. you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found