Skip to content

Commit c8a3e37

Browse files
authored
fix(material): avoid define hidden prop in field templateOptions (#1175)
1 parent f944bdb commit c8a3e37

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/material/form-field/src/field.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export abstract class FieldType extends CoreFieldType implements OnInit, AfterVi
2222
ngAfterViewInit() {
2323
if (this.matPrefix || this.matSuffix) {
2424
setTimeout(() => {
25-
defineHiddenProp(this.to, 'prefix', this.matPrefix);
26-
defineHiddenProp(this.to, 'suffix', this.matSuffix);
25+
defineHiddenProp(this.field, '_matPrefix', this.matPrefix);
26+
defineHiddenProp(this.field, '_matSuffix', this.matSuffix);
2727
});
2828
}
2929
}

src/material/form-field/src/form-field.wrapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import { Subject } from 'rxjs';
2121
</mat-label>
2222
2323
<ng-container matPrefix>
24-
<ng-container *ngTemplateOutlet="to.prefix"></ng-container>
24+
<ng-container *ngTemplateOutlet="to.prefix ? to.prefix : field['_matPrefix']"></ng-container>
2525
</ng-container>
2626
2727
<ng-container matSuffix>
28-
<ng-container *ngTemplateOutlet="to.suffix"></ng-container>
28+
<ng-container *ngTemplateOutlet="to.suffix ? to.suffix : field['_matSuffix']"></ng-container>
2929
</ng-container>
3030
3131
<!-- fix https://github.com/angular/material2/issues/7737 by setting id to null -->

0 commit comments

Comments
 (0)