Description
When mat-form-field contains mat-error with a simple @if, then it is rendered properly. However, if we nest @if, error will be squished inside the form, instead of being present in mat-mdc-form-field-subscript-wrapper.
<mat-form-field appearance="outline">
<input formControlName="bbb" matInput/>
@if ( true ) {
<mat-error>Nice error</mat-error>
}
</mat-form-field>
Reproduction
https://stackblitz.com/edit/stackblitz-starters-nhxdncvv?file=src%2Fmain.ts
Expected Behavior
Renders properly:

@if( true ) {
<mat-error>Nice error</mat-error>
}
Actual Behavior
Doesn't render properly:

@if( true ) {
@if ( true ) {
<mat-error>Terrible error</mat-error>
}
}
Environment
- Angular: 21
- CDK/Material: 21