允许用户使用Angularjs ui引导程序仅选择今天的日期或未来的日期
Allow user to select only todays date or future date using Angularjs ui bootstrap
我使用的是ui引导指令ui日期选择器。我想设置日期选择器,用户只能选择今天的日期或未来的日期。这是日期选择器的html:
<div class="input-group">
<input type="text" class="form-control"
uib-datepicker-popup="yyyy-MM-dd"
name="start_date"
ng-model="loan.start_date"
is-open="popup1.opened"
datepicker-options="dateOptions"
ng-required="true"
close-text="Close"
alt-input-formats="altInputFormats"
/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
以下是我在javascript方面的内容:
$scope.inlineOptions = {
customClass: getDayClass,
minDate: new Date(),
showWeeks: true
};
$scope.dateOptions = {
dateDisabled: disabled,
formatYear: 'yy',
maxDate: new Date("2020-04-1"),
minDate: new Date() ,
startingDay: 1
};
我该怎么做才能完成这件事呢,提前谢谢。
你的javascript看起来不错,但你的标记似乎有点偏离。看看这个plunker(从Angular original修改而来),它是一个工作示例。
$scope.dateOptions = {
dateDisabled: disabled,
formatYear: 'yy',
minDate: new Date(),
startingDay: 1
};
<p class="input-group">
<input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup2.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open2()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
相关文章:
- 如何在模式弹出窗口中使用引导程序日期和时间选择器
- 在日期更改后更新Angular UI引导程序日期选择器选项
- 引导程序日期时间选择器来自另一个日期时间选择器
- 从datetimepicker引导程序上点击的日期获取点击事件
- 如何在引导程序datetimepicker js文件中的datetime picker中传播以前的日期
- 如何从引导程序日期选择器中获取更改的日期
- KnockoutJS处理引导程序日期选择器和日期格式
- 在thymelaf页面中格式化引导程序日期选择器
- 如何初始化Twitter引导程序表单助手日期选择器
- 引导程序3日期选择器-计数活动日期
- 如何在一个地方声明angular ui引导程序日期选择器设置
- 允许用户使用Angularjs ui引导程序仅选择今天的日期或未来的日期
- 将引导程序日期时间选择器添加到C#中中继器内的TextBox中
- 如何在引导程序中比较结束日期和开始日期,以确保结束日期大于开始日期
- 选项“;daysOfWeekDisabled”;在引导程序日期时间选择器中不起作用
- 引导程序中的单个日期、月份和年份下拉列表
- 如何自动关闭并单击图标日期选择器引导程序
- 将当前日期作为占位符最初放置在输入字段日期选取器引导程序中
- 日期范围引导程序
- 日期选取器引导程序不更改值