在 Angularjs 日期选择器中禁用特定日期 [英] Disable specific dates in Angularjs date picker
问题描述
我想在 AngularJS
的日期选择器中禁用特定日期.
I want to disable specific dates in the date picker of AngularJS
.
我正在为组件使用 AngularJS-bootstrap
css.
I am using AngularJS-bootstrap
css for components.
我想禁用的日期将根据组合中先前值的选择动态更改.
The dates which I want to disable will be changing dynamically based on the selection of previous value in combo.
我相信 date-disabled="disabled(date, mode)"
应该可以工作,但不确定.
I believe date-disabled="disabled(date, mode)"
should work, though not sure.
我该怎么做?
推荐答案
我假设您正在使用来自 Angular-UI 的 Datepicker
指令.date-disabled
属性允许您禁用某些日期(例如周末).看到这个 plunk http://plnkr.co/edit/gGAU0L?p=preview
I'm assuming you are using the Datepicker
directive from Angular-UI. The date-disabled
attribute lets you disable certain dates (weekends for example). See this plunk http://plnkr.co/edit/gGAU0L?p=preview
如果您想根据选择动态禁用日期,您可以使用 min
和 max
属性和观察者.请参阅 http://plnkr.co/edit/W5pb1boMLOHZFnWkMU8o?p=preview
If you want to dynamically disable dates based on selection, you can use the min
and max
attributes and watchers. See http://plnkr.co/edit/W5pb1boMLOHZFnWkMU8o?p=preview
http://angular-ui.github.io/bootstrap/#/datepicker
这篇关于在 Angularjs 日期选择器中禁用特定日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!