angularjs - Angular time validation -
in following sample of code creating input take time ex. meeting over.
<input ui-timepicker name="eventtimepickerto" id="eventtimepickerto" class="form-control" autocomplete="off" attachlevel="-1" placeholder="@webresources.placeholderendtime" ng-model="eventdetails.datetimeto" time-pattern="@validatorregex.validtimeorempty" ng-disabled="eventdetails.permissions.timepickerdisabled" ng-change="saveeventdetails()" ng-blur="saveeventdetails()" />
what want validate input should have max time 14:00 , print error message in case of time>14:00. unfortunatelly ng-max doesn't work.. welcome!
try using min
, max
attributes, set date string. example
<input class="col-xs-12 -th-txt" type="date" name="date_field_{{field.id}}" ng-if="field.validationminvalue && field.validationmaxvalue" ng-required="field.required" min="{{field.validationminvalue}}" max="{{field.validationmaxvalue}}" ng-model="field.model" />
Comments
Post a Comment