diff --git a/CHANGELOG.md b/CHANGELOG.md index 15854c2..3452d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,12 @@ ## 1.4.0 * Enhancement: Tested and update peer dependency compatibility to allow `@angular/core`: `^7.0.0`, `@angular/cdk`: `^7.0.0`, `@angular/material`: `^7.0.0` -* Enhancement: Allow disabling initial focusing of the input field with `@Input() disableInitialFocus` [#47](https://github.com/bithost-gmbh/ngx-mat-select-search/issues/47) +* Enhancement: Allow disabling initial focusing of the input field with `@Input() disableInitialFocus` + [#47](https://github.com/bithost-gmbh/ngx-mat-select-search/issues/47) +* Bugfix: Clearing the search input by clicking the clear icon did not work with `[clearSearchInput]="false"` + [#55](https://github.com/bithost-gmbh/ngx-mat-select-search/issues/55) + + Thanks to @ofriedrich for reporting ## 1.3.1 * Bugfix: Error thrown when used together with `*ngIf` [#53](https://github.com/bithost-gmbh/ngx-mat-select-search/issues/53) diff --git a/src/app/mat-select-search/mat-select-search.component.ts b/src/app/mat-select-search/mat-select-search.component.ts index e13b5c2..88bac0e 100755 --- a/src/app/mat-select-search/mat-select-search.component.ts +++ b/src/app/mat-select-search/mat-select-search.component.ts @@ -195,7 +195,9 @@ export class MatSelectSearchComponent implements OnInit, OnDestroy, AfterViewIni } } else { // clear it when closing - this._reset(); + if (this.clearSearchInput) { + this._reset(); + } } }); @@ -322,10 +324,8 @@ export class MatSelectSearchComponent implements OnInit, OnDestroy, AfterViewIni if (!this.searchSelectInput) { return; } - if (this.clearSearchInput) { - this.searchSelectInput.nativeElement.value = ''; - this.onInputChange(''); - } + this.searchSelectInput.nativeElement.value = ''; + this.onInputChange(''); if (focus) { this._focus(); }