MadMac
MadMac

Reputation: 4871

ion-input Can't bind to 'errorStateMatcher'

I am trying to duplicate some of my working angular code into an Ionic project and I am getting the following error. Can I not use an ErrorStateMatcher in Ionic? Any suggestions on how to resolve the error?

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'errorStateMatcher' since it isn't a known property of 'ion-input'.
1. If 'ion-input' is an Angular component and it has 'errorStateMatcher' input, then verify that it is part of this module.
2. If 'ion-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("="password" [(ngModel)]="passwordConfirm" name="passwordConfirm" formControlName="confirmPassword"  [ERROR ->][errorStateMatcher]="matcher"></ion-input>
            <div *ngFor="let validation of memberValidatio"): ng:///RegisterPageModule/RegisterPage.html@65:125



 <ion-input type="password" [(ngModel)]="passwordConfirm" name="passwordConfirm" formControlName="confirmPassword"  [errorStateMatcher]="matcher"></ion-input>

Upvotes: 0

Views: 724

Answers (1)

Omri L
Omri L

Reputation: 769

ErrorStateMatcher is defined in @angular/material library. Make sure you add the library and import the necessary modules.

The mat-form-field allows you to associate error messages with your matInput. By default, these error messages are shown when the control is invalid and either the user has interacted with (touched) the element or the parent form has been submitted. If you wish to override this behavior (e.g. to show the error as soon as the invalid control is dirty or when a parent form group is invalid), you can use the errorStateMatcher property of the matInput

For more information see: Getting Started with Angular Material in Ionic 4

Upvotes: 1

Related Questions