I have a large form part, that shall be disabled in some scenarios.
I am using a <fieldset>
tag with ng-disabled
attribute, to enable/disable the form part.
<ng-form name="myForm">
<fieldset ng-disabled="myModel.isFieldsetDisabled">
<input id="myTextField" type="text" ng-required="true" ng-model="myModel.myAttribute">
... lots of other fields
</fieldset>
</ng-form>
The problem is: When I disable the <fieldset>
, the ng-form is still invalid, because some of the input fields are empty (but ought to be required). I expected these validations to be turned off when disabled.
How to achieve a valid ng-form without fumbling with all ng-required attributes on all input fields in the disabled form.
see the plunker: https://plnkr.co/edit/2JpSFqBqwdfgTa2wO4Ei?p=preview