ng2-select
ng2-select copied to clipboard
SelectItem with id=0
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
No wonder why my option with id = 0 is not showing up! This is a really big bug.
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