You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically the problem is I can't use the required attribute with mdInput in my "reactive" code based form. This is because it automatically adds validators to the form control which causes problems when a field is added or removed through ngIf. These fields which are marked required will keep the required validator on the form control even after the field is no longer in the dom.
What is the current behavior?
required field is incompatible with reactive forms.
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: https://goo.gl/DlHd6U
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, browsers are affected?
Is there anything else we should know?
lib/input/input-container.html
Uses the "required" attribute only
<span class="mat-placeholder-required" *ngIf="_mdInputChild.required">*</span>
Maybe if there was another attribute it would be helpful for reactive forms users who don't want the automatic validators added by Angular framework...
Then I set the mdinput.required = true manually to trick material to show the asterisk so I don't have the issues with the automatically added validators.
The text was updated successfully, but these errors were encountered:
Bug, feature request, or proposal:
Bug/Proposal
What is the expected behavior?
Basically the problem is I can't use the required attribute with mdInput in my "reactive" code based form. This is because it automatically adds validators to the form control which causes problems when a field is added or removed through ngIf. These fields which are marked required will keep the required validator on the form control even after the field is no longer in the dom.
What is the current behavior?
required field is incompatible with reactive forms.
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: https://goo.gl/DlHd6U
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, browsers are affected?
Is there anything else we should know?
lib/input/input-container.html
Uses the "required" attribute only
<span class="mat-placeholder-required" *ngIf="_mdInputChild.required">*</span>
Maybe if there was another attribute it would be helpful for reactive forms users who don't want the automatic validators added by Angular framework...
<span class="mat-placeholder-required" *ngIf="_mdInputChild.required || _mdInputChild.mdRequired">*</span>
Basically I end up working around this by doing the following ...
Then I set the
mdinput.required = true
manually to trick material to show the asterisk so I don't have the issues with the automatically added validators.The text was updated successfully, but these errors were encountered: