mat-error doesnt get displayed when used with mat-date-range-input even though error is set

679 views Asked by At

I have the following date range picker:

<mat-form-field>
     <mat-label>Label</mat-label>
          <mat-date-range-input
            [rangePicker]="picker">
            <input formControlName="dateRangeFrom" id="dateRangeFrom" matStartDate
              placeholder="From">
            <input formControlName="dateRangeTo" id="dateRangeTo" matEndDate
              placeholder="To">
          </mat-date-range-input>
          <mat-error *ngIf="filterForm.controls.dateRangeFrom.hasError('matDatepickerParse')">
            Parse Error
          </mat-error>
          <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
          <mat-date-range-picker #picker></mat-date-range-picker>
        </mat-form-field>

Even tho the control has the error, and when debugging, hasError returns true, the mat-error doesnt get displayed. When i put it outside the form-field, it does get displayed, but of course thats not what i want. Any idea why this happens ?

0

There are 0 answers