diff --git a/projects/igniteui-angular/src/lib/directives/input/input.directive.ts b/projects/igniteui-angular/src/lib/directives/input/input.directive.ts index ed7717e64c9..9a8dcb5b5e5 100644 --- a/projects/igniteui-angular/src/lib/directives/input/input.directive.ts +++ b/projects/igniteui-angular/src/lib/directives/input/input.directive.ts @@ -52,9 +52,7 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy { @Input('value') set value(value: any) { this.nativeElement.value = value; - if (!this.ngControl && this._hasValidators) { - this._valid = this.nativeElement.checkValidity() ? IgxInputState.VALID : IgxInputState.INVALID; - } + this.checkValidity(); } /** * Gets the `value` propery. @@ -147,9 +145,7 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy { */ @HostListener('input') public onInput() { - if (!this.ngControl && this._hasValidators()) { - this._valid = this.nativeElement.checkValidity() ? IgxInputState.VALID : IgxInputState.INVALID; - } + this.checkValidity(); } /** *@hidden @@ -297,4 +293,10 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy { public set valid(value: IgxInputState) { this._valid = value; } + + private checkValidity() { + if (!this.ngControl && this._hasValidators) { + this._valid = this.nativeElement.checkValidity() ? IgxInputState.VALID : IgxInputState.INVALID; + } + } }