ng2-select icon indicating copy to clipboard operation
ng2-select copied to clipboard

SelectItem with id=0

Open nerbos opened this issue 8 years ago • 2 comments

Hi,

When you create a SelectItem with an id=0 the object will be created with the text as id, due to:

ng2-select/src/select/select-item.ts (line: 11)

    if (typeof source === 'object') {
      this.id = source.id || source.text;`

I would suggest to change this code into something like this:

    if (typeof source === 'object') {
      this.id = (typeof source.id === 'undefined' || source.id === null ? source.text : source.id);`

Best regards

nerbos avatar Oct 13 '17 16:10 nerbos

No wonder why my option with id = 0 is not showing up! This is a really big bug.

nulayuhz avatar Mar 05 '19 20:03 nulayuhz

No wonder why my option with id = 0 is not showing up! This is a really big bug.

this.items = [{ id: "0", text: "Inactive" }, { id: "1", text: "Active" }];

like this, we can implement Capture

nikhilkhot46 avatar Apr 26 '19 07:04 nikhilkhot46