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
I would expect that when field.required is false, <md-input> should take notice of that, which it does. The problem occurs with formControlName, because the attribute required will be on the input (as required="false") even if it is set to false, which means that the control because required due to the presence of the attribute.
But the above introduces a different problem with <md-input>, as in it no longer marks the component as required (missing *).
What is the current behavior?
<md-input> should work with attr.required as well, as the HTML spec does not required the attribute to have a value or not, having it on the input element is enough to mark it as required.
What is the use-case or motivation for changing an existing behavior?
Properly marking <md-input> as required is necessary in order to follow the specs and to provide a visual indication to the user that the field must be filled.
Which versions of Angular, Material, OS, browsers are affected?
Angular 2 RC.5
Angular 2 Material 2.0.0-alpha.7-4
Is there anything else we should know?
@angular/forms works with [attr.required], there are no obvious bugs coming from there.
The problem might be at input.html#L27, instead of [required]="required" it should be [attr.required]="required || null" (null must be set in order for the attribute not be rendered).
The text was updated successfully, but these errors were encountered:
rolandjitsu
changed the title
<md-input> should work with attr.required
<md-input> should work with [attr.required]
Sep 9, 2016
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Consider the following scenario:
I would expect that when
field.required
isfalse
,<md-input>
should take notice of that, which it does. The problem occurs withformControlName
, because the attributerequired
will be on the input (asrequired="false"
) even if it is set tofalse
, which means that the control because required due to the presence of the attribute.I can use
attr.required
:But the above introduces a different problem with
<md-input>
, as in it no longer marks the component as required (missing*
).What is the current behavior?
<md-input>
should work withattr.required
as well, as the HTML spec does not required the attribute to have a value or not, having it on the input element is enough to mark it as required.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: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd
What is the use-case or motivation for changing an existing behavior?
Properly marking
<md-input>
as required is necessary in order to follow the specs and to provide a visual indication to the user that the field must be filled.Which versions of Angular, Material, OS, browsers are affected?
Angular 2 RC.5
Angular 2 Material 2.0.0-alpha.7-4
Is there anything else we should know?
@angular/forms works with
[attr.required]
, there are no obvious bugs coming from there.The problem might be at input.html#L27, instead of
[required]="required"
it should be[attr.required]="required || null"
(null
must be set in order for the attribute not be rendered).The text was updated successfully, but these errors were encountered: