[英]How to prevent from manually changing the date greater than max-date for uib-datepicker
I had a datepicker where I had set the max-date to today date..It is working..But the issue is can manually change the date greater than max date in the text field itself...How can we prevent this 我有一个日期选择器,我将最大日期设置为今天日期..它正在工作..但问题是可以手动更改文本字段本身中大于最大日期的日期...我们如何防止这种情况
fiddle
https://jsfiddle.net/cpu4euoj/58/ https://jsfiddle.net/cpu4euoj/58/
Ex:When I click on text field ,the date picker opens and I can select date greater than today..But manually I can change the date greater than today 例如:当我点击文本字段时,日期选择器打开,我可以选择比今天更大的日期..但手动我可以更改日期大于今天
can someone help.Thanks. 可以有人帮忙。谢谢。
you can do something like so: 你可以这样做:
$scope.checkDate = function(AvailableDate){
if(AvailableDate > this.availableDateOptions.maxDate){
$scope.AvailableDate = this.availableDateOptions.maxDate;
}
}
HTML: (add ng-change) HTML :(添加ng-change)
<input type="text" class="form-control" uib-datepicker-popup="{{dateFormat}}" ng-model="AvailableDate" ng-change="checkDate(AvailableDate)" name="availabledate" is-open="availableDatePopup.opened" datepicker-options="availableDateOptions" ng-required="true" close-text="Close" ng-click="OpenAvailableDate()"
placeholder="Available Date" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.