This code is working fine and properly (without ngTemplateOutlet):
<mat-form-field [formGroup]="formGroup">
<input matInput type="text"
[formControlName]="fControlName"
>
<ng-container *ngIf="isShowErrors()" ngProjectAs="mat-error">
<ng-container *ngFor="let error of showSMErrors" >
<mat-error>{{ error.message }}</mat-error>
</ng-container>
</ng-container>
</mat-form-field>
But this code isnt working properly(with ngTemplateOutlet), why? (just see the error.message like a normal red color text):
<mat-form-field [formGroup]="formGroup">
<input matInput type="text"
[formControlName]="fControlName"
>
<ng-container *ngTemplateOutlet="showErrorsTemplate"></ng-container>
</mat-form-field>
<ng-template #showErrorsTemplate ngProjectAs="mat-error">
<ng-container *ngIf="isShowErrors()" >
<ng-container *ngFor="let error of showSMErrors" >
<mat-error>{{ error.message }}</mat-error>
</ng-container>
</ng-container>
</ng-template>
Any ideas? Thanks!