Skip to content

Commit f29c2a2

Browse files
Merge pull request #9 from RandomSoftwareSL/bugfix/placeholder-not-available
placeholder not availabel issues
2 parents 3c6ad58 + 5bbbded commit f29c2a2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

projects/type-head-input/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@randomsoftwareltd/type-head-input",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"peerDependencies": {
55
"@angular/common": "^17.2.3",
66
"@angular/core": "^17.2.3",

projects/type-head-input/src/lib/type-head-input.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
(onHide)="select.resetFilter()"
2929
[appNumbersOnly]="isNumberInput"
3030
(onClick)="onClick()"
31+
(onBlur)="setEmptyHandler()"
3132
>
3233
<!-- item template -->
3334
<ng-template *ngIf="!itemTemplate" let-option pTemplate="item">

projects/type-head-input/src/lib/type-head-input.component.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@ export class TypeHeadInputComponent {
185185
}
186186

187187
onFilterEmitter(event: any) {
188+
this.setEmptyHandler();
188189
this.searchValue =
189190
typeof this.select?.value === "object" &&
190-
this.select?.value.hasOwnProperty("value")
191+
this.select?.value?.hasOwnProperty("value")
191192
? this.select?.value?.value
192193
: this.select?.value;
193194
if (this.enableServerSideData) {
@@ -217,4 +218,10 @@ export class TypeHeadInputComponent {
217218
this.searchValue = "";
218219
}
219220
}
221+
222+
setEmptyHandler = () => {
223+
if (this.control.value === "") {
224+
this.control.patchValue(null);
225+
}
226+
};
220227
}

0 commit comments

Comments
 (0)