Skip to content

Commit

Permalink
fix(Input): #3550 Fixed a bad validation check.
Browse files Browse the repository at this point in the history
  • Loading branch information
gedinakova committed Jan 14, 2019
1 parent 6402b69 commit 493d96a
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 493d96a

Please sign in to comment.