It seems to be impossible to setup matSuffix as a hostDirective.
Angular team lately made all material components standolone, which supposed to fix this issue but I still can’t make it working.
@Component({
selector: 'app-custom-suffix',
template: `
<mat-icon
color="warn"
>info_outline</mat-icon>
`,
hostDirectives: [
MatSuffix,
MatTooltip
],
imports: [MatIconModule],
standalone: true,
providers: []
})
export class CustomSuffixComponent {
constructor() {
const tooltip = inject(MatTooltip);
tooltip .message = 'test';
}
}
<mat-form-field>
...
<app-custom-suffix></app-custom-suffix>
</mat-form-field>
Tooltip seems to be applied correctly, even though I could not setup it’s value within hostDirectives and needed to do it in constructor. MatSuffix on the other hand seems not to be applied at all.