Angularjs日期选择器会记住最大日期验证错误消息

时间:2014-12-30 16:28:15

标签: angularjs datepicker

将Angularjs与spring(java)一起使用

我有以下Angularjs bootstrap datepicker。当字段为空时它显示错误我正在尝试进行审核验证,这是今天的日期。如果用户类型min-date应显示错误消息。

我尝试像'form.offerStartDate。$ error.mindate'那样放置支票,但错误对象中没有mindate的属性。任何帮助表示感谢。

<p class="input-group">
                <input type="text" name="offerStartDate" class="form-control" ng-required="true" 
                    ng-class="{error: form.offerStartDate.$dirty && form.offerStartDate.$invalid}"  
                    datepicker-popup="MM-dd-yyyy" ng-model="formData.offerStartDate"
                    is-open="startDateOpened" min-date="minDate"
                    datepicker-options="dateOptions"
                    date-disabled="disabled(date, mode)" 
                    close-text="Close" /> <span class="input-group-btn">
                    <button type="button" class="btn btn-default" ng-click="open($event,'startDate')">
                        <i class="glyphicon glyphicon-calendar"></i>
                    </button>
                </span>
            </p>
            </div>

            <div ng-show="form.offerStartDate.$dirty && form.offerStartDate.$invalid">
                    <small class="err-msg" ng-show="form.offerStartDate.$error.required">
                        Offer Start Date is required.
                    </small>
<small class="err-msg" ng-show="form.offerStartDate.$error.mindate">
                        Offer mindate is today's date.
                    </small>
                </div>

1 个答案:

答案 0 :(得分:0)

尝试在min-date

中将min更改为input

可能与此问题有关: https://github.com/angular-ui/bootstrap/issues/2189

相关问题