From 493d96a3762e3b7e91ddd926e9340530e4d027fa Mon Sep 17 00:00:00 2001 From: gedinakova Date: Mon, 14 Jan 2019 21:13:44 +0200 Subject: [PATCH] fix(Input): #3550 Fixed a bad validation check. --- .../src/lib/directives/input/input.directive.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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 d94d467d3b2..ce85c152261 100644 --- a/projects/igniteui-angular/src/lib/directives/input/input.directive.ts +++ b/projects/igniteui-angular/src/lib/directives/input/input.directive.ts @@ -28,7 +28,7 @@ export enum IgxInputState { @Directive({ selector: '[igxInput]' }) -export class IgxInputDirective implements AfterViewInit, OnChanges, OnDestroy { +export class IgxInputDirective implements AfterViewInit, OnDestroy { private _valid = IgxInputState.INITIAL; private _statusChanges$: Subscription; @@ -54,6 +54,7 @@ export class IgxInputDirective implements AfterViewInit, OnChanges, OnDestroy { @Input('value') set value(value: any) { this.nativeElement.value = value; + this.checkValidity(); } /** * Gets the `value` propery. @@ -176,14 +177,6 @@ export class IgxInputDirective implements AfterViewInit, OnChanges, OnDestroy { this.cdr.detectChanges(); } - /** - *@hidden - */ - ngOnChanges(changes: SimpleChanges) { - if (changes.value && !changes.value.firstChange) { - this.checkValidity(); - } - } /** *@hidden */ @@ -304,7 +297,7 @@ export class IgxInputDirective implements AfterViewInit, OnChanges, OnDestroy { } private checkValidity() { - if (!this.ngControl && this._hasValidators) { + if (!this.ngControl && this._hasValidators()) { this._valid = this.nativeElement.checkValidity() ? IgxInputState.VALID : IgxInputState.INVALID; } }