I have a form with a save button which is being disable using $pristine and $invalid properties. Form has a drop down menu which contains a blank value as Select option. Once I selected the blank value it always sets the from's $invalid property to false. Could anyone suggest me an option?
My save button code like this
<button class="btn btn-primary app-form-buttons" disabled="disabled" name="btnSave" ng- disabled="myForm.$pristine || myForm.$invalid" type="submit">
<i class="icon-save"></i>
</button>
Drop down code like this
<div class="col-sm-8 col-xs-11">
<select class="form-control" name="Type" ng-model="bus.route" required ng-options="bus.type as type.Type for type in types" >
<option>---Please Choose---</option>
</select>
</div>
Problem has been solved. I was trying to validate the form using required attribute. Which had gave me an invalid error when I select the blank value. To overcome the problem I used custom method inside disable attribute.