-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Form fields show required asterisk when validator is set through reactive form
What is the current behavior?
form fields do not show the required asterisk when set through a reactive form model
What are the steps to reproduce?
Providing a StackBlitz reproduction is the best way to share your issue.
https://stackblitz.com/edit/angular-p3sswf?file=src%2Fapp%2Fapp.component.ts
What is the use-case or motivation for changing an existing behavior?
I would like to be able to have full control over when the field should be required or not (during creation of the fields), without having to add helper functions for the required
parameter in the template.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 6.0.7, material 6.3.2
Is there anything else we should know?
If I add a required attribute to the field itself it works.
The actual validation on required does work, focusing and defocusing shows the red error outline. I also noticed from inspecting the elements the classes actually get added (ng-star-inserted
), it just doesn't show up:
Not working: