I am working on a form that displays controls based on the property
data-ng-hide="objective.editMode"
:
<form class="form-horizontal" role="form" name="adduserform">
<div class="form-group">
<label for="title6" class="col-sm-5 control-label">Progress</label>
<div class="col-sm-6">
<input data-ng-hide="objective.editMode" type="number" min="0" max="100"
data-ng-model="newTask.Progress" class="form-control" required />
<input data-ng-show="objective.editMode" type="number" min="0" max="100"
data-ng-model="objective.Progress" class="form-control" required />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<span data-ng-hide="editMode">
<input data-ng-hide="objective.editMode" type="submit" value="Add"
ng-disabled="adduserform.$invalid" data-ng-click="add()"/>
<input data-ng-show="objective.editMode" type="submit" value="Save"
ng-disabled="adduserform.$invalid" data-ng-click="Save()" />
</span>
</div>
</div>
</form>
I'm wondering if adduserform.$invalid
can only check the displayed controls on the form? Because adduserform.$invalid
requires all controls to be filled, but not all controls are visible depending on objective.editMode
.