From 5bbbdeda3ae624a2f6b1c9de8d5b1000d887e827 Mon Sep 17 00:00:00 2001 From: sachith94-lion Date: Thu, 16 May 2024 13:03:11 +0530 Subject: [PATCH] placeholder not availabel issues --- projects/type-head-input/package.json | 2 +- .../src/lib/type-head-input.component.html | 1 + .../type-head-input/src/lib/type-head-input.component.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/type-head-input/package.json b/projects/type-head-input/package.json index 1f47fde..c44fc3c 100644 --- a/projects/type-head-input/package.json +++ b/projects/type-head-input/package.json @@ -1,6 +1,6 @@ { "name": "@randomsoftwareltd/type-head-input", - "version": "2.0.7", + "version": "2.0.8", "peerDependencies": { "@angular/common": "^17.2.3", "@angular/core": "^17.2.3", diff --git a/projects/type-head-input/src/lib/type-head-input.component.html b/projects/type-head-input/src/lib/type-head-input.component.html index e87e78d..46deaa7 100644 --- a/projects/type-head-input/src/lib/type-head-input.component.html +++ b/projects/type-head-input/src/lib/type-head-input.component.html @@ -28,6 +28,7 @@ (onHide)="select.resetFilter()" [appNumbersOnly]="isNumberInput" (onClick)="onClick()" + (onBlur)="setEmptyHandler()" > diff --git a/projects/type-head-input/src/lib/type-head-input.component.ts b/projects/type-head-input/src/lib/type-head-input.component.ts index 16e0caa..0589f48 100644 --- a/projects/type-head-input/src/lib/type-head-input.component.ts +++ b/projects/type-head-input/src/lib/type-head-input.component.ts @@ -185,9 +185,10 @@ export class TypeHeadInputComponent { } onFilterEmitter(event: any) { + this.setEmptyHandler(); this.searchValue = typeof this.select?.value === "object" && - this.select?.value.hasOwnProperty("value") + this.select?.value?.hasOwnProperty("value") ? this.select?.value?.value : this.select?.value; if (this.enableServerSideData) { @@ -217,4 +218,10 @@ export class TypeHeadInputComponent { this.searchValue = ""; } } + + setEmptyHandler = () => { + if (this.control.value === "") { + this.control.patchValue(null); + } + }; }