Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit e8d6f47

Browse files
fix: 🐛 broken matInput without ngModel
1 parent 8b8977d commit e8d6f47

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

projects/ngx-errors/src/lib/set-mat-input-error-state-matcher.directive.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class SetMatInputErrorStateMatcherDirective implements OnDestroy {
1717
@Self() private matInput: MatInput,
1818
private overriddenShowWhen: OverriddenShowWhen
1919
) {
20+
if (!this.matInput.ngControl) {
21+
return;
22+
}
23+
2024
const control = this.matInput.ngControl.control;
2125

2226
const sub = overriddenShowWhen.controlOverridden$

projects/playground/src/app/lazy/lazy.component.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
<button type="submit">Submit</button>
3232
</form>
3333

34+
<hr />
35+
3436
<mat-form-field appearance="fill">
3537
<mat-label>Name</mat-label>
3638

@@ -53,3 +55,9 @@
5355
<span ngxError="minlength">Name should be at least 10 chars - DIMA</span>
5456
</mat-error>
5557
</mat-form-field>
58+
59+
<mat-form-field appearance="fill">
60+
<mat-label>Name</mat-label>
61+
62+
<input matInput value="Input without ngModel" required autocomplete="off" />
63+
</mat-form-field>

0 commit comments

Comments
 (0)