diff --git a/src/app/components/autocomplete/autocomplete.ts b/src/app/components/autocomplete/autocomplete.ts index 0c433291b4e..21d345a1e2f 100755 --- a/src/app/components/autocomplete/autocomplete.ts +++ b/src/app/components/autocomplete/autocomplete.ts @@ -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); } @@ -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);