In my angular page, I have a form:
<div class="row-fluid">
<div class="control-group" ng-class="{error:form.startDate.$invalid && form.startDate.$dirty && error:form.endDate.$invalid && form.endDate.$dirty}">
<div class="row-fluid">
<div class="span4">
<label><b>Start Date</b> (mm/dd/yyyy)</label>
<input type="date"
id="startDate"
name="startDate"
max="{{maxDate}}"
min="{{minDate}}"
ng-pattern="/^((\d{4})-(\d{2})-(\d{2})|(\d{2})\/(\d{2})\/(\d{4}))$/"
ng-model="startDate"
required />
</div>
<div class="span4">
<label><b>End Date</b> (mm/dd/yyyy)</label>
<input type="date"
id="endDate"
name="endDate"
max="{{maxDate}}"
min="{{minDate}}"
ng-pattern="/^((\d{4})-(\d{2})-(\d{2})|(\d{2})\/(\d{2})\/(\d{4}))$/"
ng-model="endDate"
required />
</div>
</div>
<div class="row-fluid">
<div class="span4">
<span ng-show="form.startDate.$dirty">
<span ng-show="form.startDate.$error.required" class="help-inline">Start Date is required</span>
<span ng-show="form.startDate.$error.pattern" class="help-inline">Invalid start date</span>
<span ng-show="form.startDate.$error.max" class="help-inline">Start Date exceeds maximum</span>
</span>
</div>
<div class="span4">
<span ng-show="form.endDate.$dirty">
<span ng-show="form.endDate.$error.required" class="help-inline">End Date is required</span>
<span ng-show="form.endDate.$error.pattern" class="help-inline">Invalid end date</span>
<span ng-show="form.endDate.$error.max" class="help-inline">End Date exceeds maximum</span>
</span>
</div>
</div>
<input type="button" value="Load Report" ng-click="getLeads()" class="btn btn-primary" />
</div>
</div>
The fields work as they should, but the validation does not. If I enter '02/30/2015' in either date field, it shows the required message instead of the invalid message.
So, the question is: How can I get the angular $dirty to validate the correct issue: the fields aren't empty, so "required" isn't valid. The date is bad, and should fire off the invalid message.

