0

enter image description here Hello,

I am using mat-Select and mat-error. There is no problem in giving a warning, but after giving a warning, the 'mat-error' breaks the 'mat-select' event broked.

I press mat-select more than once (click) event but it works.

The place where the mat-error warning is making the click event invalid.

sample code is as follows.

 <mat-select class="classic" 
    disableOptionCentering 
    formControlName="bonusId" 
    selectionChange)="onChangeCategory($event)">
            <mat-option class="kt-option" *ngFor="let bonusType of bonusTypeDataSource" [value]="bonusType.id">
    {{bonusType.id}}.{{bonusType.name}}
             </mat-option>
        </mat-select>
        <mat-error class="form-control-feedback" *ngIf="bonusFormGroup.controls.bonusId.errors && (bonusFormGroup.controls.bonusId.dirty || bonusFormGroup.controls.bonusId.touched)
&& bonusFormGroup.controls.bonusId.errors.required">
           Error
    </mat-error>
 </mat-form-field>
Onur Dikmen
  • 339
  • 1
  • 6
  • 17
  • You probably want to make the `ngIf` for the mat error be ` ...` and remove the nested `ngIf` on the `p` tag – laudebugs Oct 20 '22 at 19:38
  • yes there is an extra if block there but the problem persists after removing it. Thanks for your suggestion. – Onur Dikmen Oct 20 '22 at 19:54

0 Answers0