Skip to content

Commit

Permalink
Fixed #9628 - AutoComplete does not display 0 as value
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Mar 11, 2021
1 parent fb32ad2 commit dc77be1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ export class AutoComplete implements AfterViewChecked,AfterContentInit,OnDestroy
}
}
else {
this.inputEL.nativeElement.value = this.field ? ObjectUtils.resolveFieldData(option, this.field)||'': option;
this.inputEL.nativeElement.value = this.field ? this.getFieldData(option) : option;
this.value = option;
this.onModelChange(this.value);
}
Expand Down Expand Up @@ -504,6 +504,11 @@ export class AutoComplete implements AfterViewChecked,AfterContentInit,OnDestroy
return this.field ? ObjectUtils.resolveFieldData(value, this.field): value;
}

getFieldData(option) {
let data = ObjectUtils.resolveFieldData(option, this.field);
return data !== null ? data : '';
}

restoreOverlayAppend() {
if (this.overlay && this.appendTo) {
this.el.nativeElement.appendChild(this.overlay);
Expand Down

0 comments on commit dc77be1

Please sign in to comment.