I am trying to get the maxlength and minlength messages to work correctly. However, I am only getting the "required" message. It then stays there until I refresh the page also. Also, is there a way to put a mask on md-datepicker that forces a user to put in like 99/99/9999 (mm/dd/yyyy). I haven't found anything on this as of yet.
<md-input-container class="md-block">
<label>{{dynElm.dob.text}}</label>
<md-datepicker ng-change="dateChange()" type="text" name="dob" ng-model="signup.date" md-open-on-focus md-current-view="year" maxlength="9" minlength="6" ng-click="md-is-open" required></md-datepicker>
<div class="hint" align="center">(MM/DD/YYYY)</div>
<div ng-messages="signup.dob.$error" style="color:red;" role="alert">
<div ng-message="required">Date of Birth field is required</div>
<div ng-message="maxlength">Use MM/DD/YYYY format for entry</div>
<div ng-message="minlength">Use MM/DD/YYYY format for entry</div>
</div>
</md-input-container>
I would suggest that instead of checking maxlength and minlength for date, check whether date is valid or not. Verify below sample (found on google) which validate entered date and also allows you to mask your entered date. DEMO
<md-datepicker-custom name="dateField"
ng-model="appCtrl.myDate"
md-placeholder="Enter date"
md-min-date="appCtrl.minDate"
md-max-date="appCtrl.maxDate"
md-custom-required="true"
md-custom-default-date="{{::appCtrl.defaultDate}}"
md-custom-mask="19/39/9999"
md-custom-clean-mask="false"
md-custom-restrict="reject">
</md-datepicker-custom>