【发布时间】:2019-01-08 11:56:18
【问题描述】:
在我用于日期时间选择的 Angular 应用程序中,我使用的是 input type="datetime-local"。
<input id="field_bookingTime" type="datetime-local" class="form-control" name="bookingTime" [(ngModel)]="bookingTime"
required/>
现在我需要禁用当前日期之前的日期和当前日期之后 3 天的日期。例如对于 min,我添加了如下所示的验证。但是验证不起作用,仍然在显示的日历中启用了以前的日期。
currentDate = new Date();
<input [min]="currentDate" id="field_bookingTime" type="datetime-local" class="form-control" name="bookingTime" [(ngModel)]="bookingTime"
required/>
【问题讨论】:
-
输入是否可以在任何Angular forms中使用?
-
是的,我正在使用角度模板驱动的表单
标签: javascript angular