diff --git a/src/lib/form-field/form-field.html b/src/lib/form-field/form-field.html
index e6c91f58a9e6..133b42f98ae8 100644
--- a/src/lib/form-field/form-field.html
+++ b/src/lib/form-field/form-field.html
@@ -52,7 +52,7 @@
*
+ *ngIf="!hideRequiredMarker && _control.required && !_control.disabled"> *
diff --git a/src/lib/input/input.spec.ts b/src/lib/input/input.spec.ts
index 96121aaae9aa..6e802befb65c 100644
--- a/src/lib/input/input.spec.ts
+++ b/src/lib/input/input.spec.ts
@@ -394,7 +394,7 @@ describe('MatInput without forms', () => {
let el = fixture.debugElement.query(By.css('label'));
expect(el).not.toBeNull();
- expect(el.nativeElement.textContent).toMatch(/hello\s+\*/g);
+ expect(el.nativeElement.textContent).toMatch(/hello +\*/g);
}));
it('should hide the required star if input is disabled', () => {
@@ -407,6 +407,7 @@ describe('MatInput without forms', () => {
expect(el).not.toBeNull();
expect(el.nativeElement.textContent!.trim()).toMatch(/^hello$/);
+ expect(el.nativeElement.textContent).not.toMatch(/\*/g);
});
it('should hide the required star from screen readers', fakeAsync(() => {
@@ -424,12 +425,13 @@ describe('MatInput without forms', () => {
let el = fixture.debugElement.query(By.css('label'));
expect(el).not.toBeNull();
- expect(el.nativeElement.textContent).toMatch(/hello\s+\*/g);
+ expect(el.nativeElement.textContent).toMatch(/hello +\*/g);
fixture.componentInstance.hideRequiredMarker = true;
fixture.detectChanges();
expect(el.nativeElement.textContent).toMatch(/hello/g);
+ expect(el.nativeElement.textContent).not.toMatch(/\*/g);
}));
it('supports the disabled attribute as binding', fakeAsync(() => {