diff --git a/src/lib/inputs/input-with-action/input-with-action.component.ts b/src/lib/inputs/input-with-action/input-with-action.component.ts index d0230a4..7bd26f3 100644 --- a/src/lib/inputs/input-with-action/input-with-action.component.ts +++ b/src/lib/inputs/input-with-action/input-with-action.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; @Component({ selector: 'iqser-input-with-action', @@ -16,6 +16,8 @@ export class InputWithActionComponent { @Output() readonly action = new EventEmitter(); @Output() readonly valueChange = new EventEmitter(); + constructor(private readonly _changeDetectorRef: ChangeDetectorRef) {} + get hasContent(): boolean { return !!this.value?.length; } @@ -24,13 +26,14 @@ export class InputWithActionComponent { return this.width === 'full' ? '100%' : `${this.width}px`; } + get isSearch(): boolean { + return this.action.observers.length === 0; + } + reset(): void { this.value = ''; this.valueChange.emit(this.value); - } - - get isSearch(): boolean { - return this.action.observers.length === 0; + this._changeDetectorRef.markForCheck(); } executeAction($event: MouseEvent): void {