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
Describe the feature:
Currently showing the required and invalid status of a form field requires developers to set the required attribute of the element and bind to the invalid property, checking both the invalid and touched properties of the form control. For required, this involves setting the attribute separately from the form validators and increasing the risk of bugs. It also forces developers to remember the difference between touched and dirty and consistently implement the validity check correctly, increasing code repetition, the risk for bugs, and the cognitive burden of developing a front end.
These properties can instead be abstracted into an Angular directive that takes in a form control and listens for status updates, setting the properties based on the state of the control itself. This approach is already taken by a few teams and should be made available more widely. The directive could also be expanded on in the future to handle other form related features.
Describe any alternatives you've considered:
The alternative is to continue setting required and invalid manually, but as noted above this can be tedious and prone to bugs.
The text was updated successfully, but these errors were encountered:
Describe the feature:
Currently showing the required and invalid status of a form field requires developers to set the
required
attribute of the element and bind to theinvalid
property, checking both theinvalid
andtouched
properties of the form control. For required, this involves setting the attribute separately from the form validators and increasing the risk of bugs. It also forces developers to remember the difference betweentouched
anddirty
and consistently implement the validity check correctly, increasing code repetition, the risk for bugs, and the cognitive burden of developing a front end.These properties can instead be abstracted into an Angular directive that takes in a form control and listens for status updates, setting the properties based on the state of the control itself. This approach is already taken by a few teams and should be made available more widely. The directive could also be expanded on in the future to handle other form related features.
Describe any alternatives you've considered:
The alternative is to continue setting
required
andinvalid
manually, but as noted above this can be tedious and prone to bugs.The text was updated successfully, but these errors were encountered: