diff --git a/src/material/form-field/directives/error.ts b/src/material/form-field/directives/error.ts index 20181978b9fb..138c76060485 100644 --- a/src/material/form-field/directives/error.ts +++ b/src/material/form-field/directives/error.ts @@ -19,7 +19,7 @@ export const MAT_ERROR = new InjectionToken('MatError'); /** Single error message to be shown underneath the form-field. */ @Directive({ - selector: 'mat-error', + selector: 'mat-error, [matError]', host: { 'class': 'mat-mdc-form-field-error mat-mdc-form-field-bottom-align', 'aria-atomic': 'true', diff --git a/src/material/form-field/form-field.html b/src/material/form-field/form-field.html index 12a3f43e6585..fb719f85cbed 100644 --- a/src/material/form-field/form-field.html +++ b/src/material/form-field/form-field.html @@ -83,7 +83,7 @@ [ngSwitch]="_getDisplayedMessages()">
- +
{ @@ -271,7 +273,7 @@ export function runHarnessTests( Error 1 - Error 2 +
Error 2
Hint 1 Hint 2 diff --git a/tools/public_api_guard/material/form-field.md b/tools/public_api_guard/material/form-field.md index e2f46bd166ca..1e40fb314ed9 100644 --- a/tools/public_api_guard/material/form-field.md +++ b/tools/public_api_guard/material/form-field.md @@ -59,7 +59,7 @@ export class MatError { // (undocumented) id: string; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -147,7 +147,7 @@ export class MatFormField implements AfterContentInit, AfterContentChecked, Afte // (undocumented) _textPrefixContainer: ElementRef; // (undocumented) - static ɵcmp: i0.ɵɵComponentDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; }