Skip to content

Commit 0a9af40

Browse files
committed
fix(combo): created a separate method for the validation logic
1 parent bb47831 commit 0a9af40

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

projects/igniteui-angular/src/lib/combo/combo.common.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,9 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12111211
/** @hidden @internal */
12121212
public handleClosed() {
12131213
this.closed.emit({ owner: this });
1214+
if(this.comboInput.nativeElement !== this.document.activeElement){
1215+
this._validateComboState();
1216+
}
12141217
}
12151218

12161219
/** @hidden @internal */
@@ -1249,12 +1252,7 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12491252
/** @hidden @internal */
12501253
public onBlur() {
12511254
if (this.collapsed) {
1252-
this._onTouchedCallback();
1253-
if (this.ngControl && this.ngControl.invalid) {
1254-
this.valid = IgxInputState.INVALID;
1255-
} else {
1256-
this.valid = IgxInputState.INITIAL;
1257-
}
1255+
this._validateComboState();
12581256
}
12591257
}
12601258

@@ -1282,6 +1280,16 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12821280
this.manageRequiredAsterisk();
12831281
};
12841282

1283+
private _validateComboState() {
1284+
this._onTouchedCallback();
1285+
1286+
if (this.ngControl && this.ngControl.invalid) {
1287+
this.valid = IgxInputState.INVALID;
1288+
} else {
1289+
this.valid = IgxInputState.INITIAL;
1290+
}
1291+
}
1292+
12851293
private get isTouchedOrDirty(): boolean {
12861294
return (this.ngControl.control.touched || this.ngControl.control.dirty);
12871295
}

0 commit comments

Comments
 (0)