![]() We would, in the second form, disable and pre-populate the firstName and lastName inputs now let’s say we want to propagate the form’s value to some state store when the form value or status changes but when the form is valid. In the log snippet above, can you also see that the form’s valid and invalid properties are both false, but the controls have values and are valid? Can you see the confusion this way of disabling controls might cause when the form’s validity is a dependency in some decisions we have to make?įor example, let's say we have a big form implementation and we are aware that some form fields will need to be disabled.įor instance, say we have a second form in a separate page that requires the firstName and lastName the user had entered in the first form. ![]() Something worth noting is that when we have all form controls disabled, irrespective of their validity status', the controls' instance status properties will be set to "DISABLED" hence the FormGroup's status will also be set to "DISABLED". Showing how having all controls disabled in a form group affects the forms status and validity ![]() Note that the firstName control is disabled by default. ![]() We’ve given the form controls default values, disabled both the controls and required the firstName control by having a required validator on its configuration. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |